MCPcopy Create free account
hub / github.com/CPChain/chain / findLine

Function findLine

tests/init_test.go:75–86  ·  view source on GitHub ↗

findLine returns the line number for the given offset into data.

(data []byte, offset int64)

Source from the content-addressed store, hash-verified

73
74// findLine returns the line number for the given offset into data.
75func findLine(data []byte, offset int64) (line int) {
76 line = 1
77 for i, r := range string(data) {
78 if int64(i) >= offset {
79 return
80 }
81 if r == '\n' {
82 line++
83 }
84 }
85 return
86}
87
88// testMatcher controls skipping and chain config assignment to tests.
89type testMatcher struct {

Callers 1

readJSONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected