MCPcopy Index your code
hub / github.com/cockroachdb/errors / parsePrintedStackEntry

Function parsePrintedStackEntry

withstack/reportable.go:172–193  ·  view source on GitHub ↗

parsePrintedStackEntry extracts the stack entry information in lines at position i. It returns the new value of i if more than one line was read.

(
	lines []string, i int,
)

Source from the content-addressed store, hash-verified

170// in lines at position i. It returns the new value of i if more than
171// one line was read.
172func parsePrintedStackEntry(
173 lines []string, i int,
174) (newI int, file string, line int, fnName string) {
175 // The function name is on the first line.
176 fnName = lines[i]
177
178 // The file:line pair may be on the line after that.
179 if i < len(lines)-1 && strings.HasPrefix(lines[i+1], "\t") {
180 fileLine := strings.TrimSpace(lines[i+1])
181 // Separate file path and line number.
182 lineSep := strings.LastIndexByte(fileLine, ':')
183 if lineSep == -1 {
184 file = fileLine
185 } else {
186 file = fileLine[:lineSep]
187 lineStr := fileLine[lineSep+1:]
188 line, _ = strconv.Atoi(lineStr)
189 }
190 i++
191 }
192 return i, file, line, fnName
193}
194
195var pkgFundamental errbase.TypeKey
196var pkgWithStackName errbase.TypeKey

Callers 2

parsePrintedStackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…