(path string, f func(string, int))
| 7 | ) |
| 8 | |
| 9 | func ForEachLineInFile(path string, f func(string, int)) error { |
| 10 | file, err := os.Open(path) |
| 11 | if err != nil { |
| 12 | return err |
| 13 | } |
| 14 | defer file.Close() |
| 15 | |
| 16 | forEachLineInStream(file, f) |
| 17 | |
| 18 | return nil |
| 19 | } |
| 20 | |
| 21 | func forEachLineInStream(reader io.Reader, f func(string, int)) { |
| 22 | bufferedReader := bufio.NewReader(reader) |
no test coverage detected