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

Function forEachLineInStream

pkg/utils/io.go:21–30  ·  view source on GitHub ↗
(reader io.Reader, f func(string, int))

Source from the content-addressed store, hash-verified

19}
20
21func forEachLineInStream(reader io.Reader, f func(string, int)) {
22 bufferedReader := bufio.NewReader(reader)
23 for i := 0; true; i++ {
24 line, _ := bufferedReader.ReadString('\n')
25 if len(line) == 0 {
26 break
27 }
28 f(line, i)
29 }
30}

Callers 2

ForEachLineInFileFunction · 0.85
Test_forEachLineInStreamFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_forEachLineInStreamFunction · 0.68