// Personal website of Chris Smith

Go » Read line-by-line

A bufio.Scanner is the most straight forward way. It can also be configured to split on other tokens instead of line-ends.

scanner := bufio.NewScanner(reader)

for scanner.Scan() {
	line := scanner.Text()
	// ...
}

err := scanner.Err()