aoc2024/day-04/internal/two/util.go

22 lines
298 B
Go

package two
import (
"bufio"
"io"
)
func readLines(r io.Reader) (*graph, error) {
graph := newGraph()
scanner := bufio.NewScanner(r)
for scanner.Scan() {
graph.data = append(graph.data, scanner.Text())
}
if err := scanner.Err(); err != nil {
return nil, err
}
return graph, nil
}