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)
| 147 | // |
| 148 | // If html is used, a stack trace is written to this file instead. |
| 149 | func 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 | |
| 184 | func showBanner() bool { |
| 185 | gtb := os.Getenv("GOTRACEBACK") |
searching dependent graphs…