MCPcopy
hub / github.com/jesseduffield/lazygit / ForEachLineInFile

Function ForEachLineInFile

pkg/utils/io.go:9–19  ·  view source on GitHub ↗
(path string, f func(string, int))

Source from the content-addressed store, hash-verified

7)
8
9func 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
21func forEachLineInStream(reader io.Reader, f func(string, int)) {
22 bufferedReader := bufio.NewReader(reader)

Callers 1

Calls 3

forEachLineInStreamFunction · 0.85
OpenMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected