MCPcopy
hub / github.com/uber-go/goleak / Parse

Method Parse

internal/stack/stacks.go:107–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105}
106
107func (p *stackParser) Parse() ([]Stack, error) {
108 for p.scan.Scan() {
109 line := p.scan.Text()
110
111 // If we see the goroutine header, start a new stack.
112 if strings.HasPrefix(line, "goroutine ") {
113 stack, err := p.parseStack(line)
114 if err != nil {
115 p.errors = append(p.errors, err)
116 continue
117 }
118 p.stacks = append(p.stacks, stack)
119 }
120 }
121
122 p.errors = append(p.errors, p.scan.Err())
123 return p.stacks, errors.Join(p.errors...)
124}
125
126// parseStack parses a single stack trace from the given scanner.
127// line is the first line of the stack trace, which should look like:

Callers 4

TestParseStackFunction · 0.80
TestParseStackErrorsFunction · 0.80
TestParseStackFixturesFunction · 0.80
getStacksFunction · 0.80

Calls 2

parseStackMethod · 0.95
ScanMethod · 0.80

Tested by 3

TestParseStackFunction · 0.64
TestParseStackErrorsFunction · 0.64
TestParseStackFixturesFunction · 0.64