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, )
| 170 | // in lines at position i. It returns the new value of i if more than |
| 171 | // one line was read. |
| 172 | func 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 | |
| 195 | var pkgFundamental errbase.TypeKey |
| 196 | var pkgWithStackName errbase.TypeKey |
no outgoing calls
no test coverage detected
searching dependent graphs…