{{- /* Join a list */ -}} {{- define "Join" -}} {{- if . -}} {{- $l := len . -}} {{- $last := minus $l 1 -}} {{- range $i, $e := . -}} {{- $e -}} {{- $isNotLast := ne $i $last -}} {{- if $isNotLast}}, {{end -}} {{- end -}} {{- end -}} {{- end -}} {{- /* Accepts a Args */ -}} {{- define "RenderArgs" -}} {{- $elided := .Elided -}} {{- if .Processed -}} {{- $l := len .Processed -}} {{- $last := minus $l 1 -}} {{- range $i, $e := .Processed -}} {{- $e -}} {{- $isNotLast := ne $i $last -}} {{- if or $elided $isNotLast}}, {{end -}} {{- end -}} {{- else -}} {{- $l := len .Values -}} {{- $last := minus $l 1 -}} {{- range $i, $e := .Values -}} {{- $e.String -}} {{- $isNotLast := ne $i $last -}} {{- if or $elided $isNotLast}}, {{end -}} {{- end -}} {{- end -}} {{- if $elided}}…{{end -}} {{- end -}} {{- /* Accepts a Call */ -}} {{- define "RenderCreatedBy" -}} {{- if and .LocalSrcPath (ne .RemoteSrcPath .LocalSrcPath) -}} RemoteSrcPath: {{.RemoteSrcPath}}
LocalSrcPath: {{.LocalSrcPath}} {{- else -}} SrcPath: {{.RemoteSrcPath}} {{- end -}}
Func: {{.Func.Complete}}
Location: {{.Location}}
{{.SrcName}}:{{.Line}} {{.Func.DirName}}.{{.Func.Name}}()
{{- end -}} {{- /* Accepts a Stack */ -}} {{- define "RenderCalls" -}} {{- range $i, $e := .Calls -}} {{- end -}} {{- if .Elided}}{{end -}}
{{$i}} {{$e.Func.DirName}} {{- if and $e.LocalSrcPath (ne $e.RemoteSrcPath $e.LocalSrcPath) -}} RemoteSrcPath: {{$e.RemoteSrcPath}}
LocalSrcPath: {{$e.LocalSrcPath}} {{- else -}} SrcPath: {{$e.RemoteSrcPath}} {{- end -}}
Func: {{$e.Func.Complete}}
Location: {{$e.Location}}
{{$e.SrcName}}:{{$e.Line}}
{{$e.Func.Name}}({{template "RenderArgs" $e.Args}})
(…)
{{- end -}} PanicParse
{{- if .Aggregated -}} {{- range $i, $e := .Aggregated.Buckets -}} {{$l := len $e.IDs}}

Signature #{{$i}}: {{$l}} routine{{if ne 1 $l}}s{{end}}: {{$e.State}} {{- if $e.SleepMax -}} {{- if ne $e.SleepMin $e.SleepMax}} [{{$e.SleepMin}}~{{$e.SleepMax}} mins] {{- else}} [{{$e.SleepMax}} mins] {{- end -}} {{- end -}}

{{if $e.Locked}} [locked] {{- end -}} {{- if $e.CreatedBy.Calls}} Created by: {{template "RenderCreatedBy" index $e.CreatedBy.Calls 0}} {{- end -}} {{template "RenderCalls" $e.Signature.Stack}} {{- end -}} {{- else -}} {{- range $i, $e := .Snapshot.Goroutines -}}

Routine {{$e.ID}}: {{$e.State}} {{- if $e.SleepMax -}} {{- if ne $e.SleepMin $e.SleepMax}} [{{$e.SleepMin}}~{{$e.SleepMax}} mins] {{- else}} [{{$e.SleepMax}} mins] {{- end -}} {{- end -}}

{{if $e.Locked}} [locked] {{- end -}} {{if $e.RaceAddr}} Race {{if $e.RaceWrite}}write{{else}}read{{end}} @ {{printf "0x%08X" $e.RaceAddr}}
{{- end -}} {{- if $e.CreatedBy.Calls}} Created by: {{template "RenderCreatedBy" index $e.CreatedBy.Calls 0}} {{- end -}} {{template "RenderCalls" $e.Signature.Stack}} {{- end -}} {{- end -}}

Metadata

Legend

Type Exported Private
Package main Sources that are in the main package. main.Foo() main.foo()
Go module Sources located inside a directory containing a go.mod file but outside $GOPATH. pkg.Foo() pkg.foo()
$GOPATH/src/... Sources located inside the traditional $GOPATH/src directory. pkg.Foo() pkg.foo()
$GOPATH/pkg/mod/... Sources located inside the go module dependency cache under $GOPATH/pkg/mod. These files are unmodified third parties. pkg.Foo() pkg.foo()
Standard library Sources from the Go standard library under $GOROOT/src/. pkg.Foo() pkg.foo()
Unknown source location Sources which location was not successfully determined. pkg.Foo() pkg.foo()
{{- .Footer -}} {{- /* Add unnecessary bottom spacing so the last tooltip from the legend is visible. */ -}}