MCPcopy Index your code
hub / github.com/maruel/panicparse / process

Function process

internal/main.go:149–182  ·  view source on GitHub ↗

process copies stdin to stdout and processes any "panic: " line found. If html is used, a stack trace is written to this file instead.

(in io.Reader, out io.Writer, p *Palette, s stack.Similarity, pf pathFormat, parse, rebase bool, html string, filter, match *regexp.Regexp)

Source from the content-addressed store, hash-verified

147//
148// If html is used, a stack trace is written to this file instead.
149func process(in io.Reader, out io.Writer, p *Palette, s stack.Similarity, pf pathFormat, parse, rebase bool, html string, filter, match *regexp.Regexp) error {
150 opts := stack.DefaultOpts()
151 if !rebase {
152 opts.GuessPaths = false
153 opts.AnalyzeSources = false
154 }
155 if !parse {
156 opts.AnalyzeSources = false
157 }
158 for first := true; ; first = false {
159 c, suffix, err := stack.ScanSnapshot(in, out, opts)
160 if c != nil {
161 // Process it even if an error occurred.
162 if err1 := processInner(out, p, s, pf, html, filter, match, c, first); err == nil {
163 err = err1
164 }
165 }
166 if err == nil {
167 // This means the whole buffer was not read, loop again.
168 in = io.MultiReader(bytes.NewReader(suffix), in)
169 continue
170 }
171 if len(suffix) != 0 {
172 if _, err1 := out.Write(suffix); err == nil {
173 err = err1
174 }
175 }
176 if err == io.EOF {
177 return nil
178 }
179 // Parts of the input will be lost.
180 return err
181 }
182}
183
184func showBanner() bool {
185 gtb := os.Getenv("GOTRACEBACK")

Callers 3

TestProcessFunction · 0.85
TestProcessTwoSnapshotsFunction · 0.85
MainFunction · 0.85

Calls 4

DefaultOptsFunction · 0.92
ScanSnapshotFunction · 0.92
processInnerFunction · 0.85
WriteMethod · 0.80

Tested by 2

TestProcessFunction · 0.68
TestProcessTwoSnapshotsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…