GoroutineHeader prints the header of a goroutine.
(g *stack.Goroutine, pf pathFormat, multipleGoroutines bool)
| 179 | |
| 180 | // GoroutineHeader prints the header of a goroutine. |
| 181 | func (p *Palette) GoroutineHeader(g *stack.Goroutine, pf pathFormat, multipleGoroutines bool) string { |
| 182 | extra := "" |
| 183 | if s := g.SleepString(); s != "" { |
| 184 | extra += " [" + s + "]" |
| 185 | } |
| 186 | if g.Locked { |
| 187 | extra += " [locked]" |
| 188 | } |
| 189 | if c := pf.createdByString(&g.Signature); c != "" { |
| 190 | extra += p.CreatedBy + " [Created by " + c + "]" |
| 191 | } |
| 192 | if g.RaceAddr != 0 { |
| 193 | r := "read" |
| 194 | if g.RaceWrite { |
| 195 | r = "write" |
| 196 | } |
| 197 | extra += fmt.Sprintf("%s%s Race %s @ 0x%08x", p.EOLReset, p.Race, r, g.RaceAddr) |
| 198 | } |
| 199 | return fmt.Sprintf( |
| 200 | "%s%d: %s%s%s\n", |
| 201 | p.routineColor(g.First, multipleGoroutines), g.ID, |
| 202 | g.State, extra, |
| 203 | p.EOLReset) |
| 204 | } |
| 205 | |
| 206 | // callLine prints one stack line. |
| 207 | func (p *Palette) callLine(line *stack.Call, srcLen, pkgLen int, pf pathFormat) string { |
no test coverage detected