Documentation ¶
Overview ¶
Package goid provides goid.GoID(), unique goroutine identifiers
m := map[goid.ThreadID]SomeInterface{} m[goid.GoID()] = …
Index ¶
- func GoID() (threadID parl.ThreadID)
- func ParseCreatedLine(createdLine string) (funcName string, IsMainThread bool)
- func ParseFileLine(fileLine string) (file string, line int)
- func ParseFirstLine(debugStack string) (ID parl.ThreadID, status parl.ThreadStatus, err error)
- func ParseFuncLine(funcLine string) (funcName string, args string)
- type Frame
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoID ¶
GoID obtains a numeric string that as of Go1.18 is assigned to each goroutine. This number is an increasing unsigned integer beginning at 1 for the main invocation
func ParseCreatedLine ¶ added in v0.4.12
ParseCreatedLine parses the second-to-last line of the stack trace. samples:
created by main.main created by main.(*MyType).goroutine1 main.main()
func ParseFileLine ¶ added in v0.4.12
ParseFileLine parses a line of a tab character then absolue file path, followed by a colon and line number, then a space character and a byte offset
"\t/gp-debug-stack/debug-stack.go:29 +0x44"
func ParseFirstLine ¶ added in v0.4.12
getID obtains gorutine ID, as of go1.18 a numeric string "1"…
func ParseFuncLine ¶ added in v0.4.12
ParseFuncLine parses a line of a package name, optionally fully qualified, and a possible receiver type name and a function name, followed by a parenthesised argument list. samples:
main.main() main.(*MyType).goroutine1(0x0?, 0x140000120d0, 0x2) codeberg.org/haraldrudell/goprogramming/std/runtime-debug/gp-debug-stack/mypackage.Fn(...)
Types ¶
type Frame ¶
type Frame struct { pruntime.CodeLocation // args like "(1, 2, 3)" Args string }
type Stack ¶
type Stack struct { // ThreadID is a unqique ID associated with this thread. // typically numeric string “1”… // it can be used as a map key or converted to string ID parl.ThreadID // Status is typically word “running” Status parl.ThreadStatus // IsMainThread indicates if this is the thread that launched main.main IsMainThread bool // Frames is a list of code locations for this thread. // [0] is the invoker of goid.NewStack(). // last is the function starting this thread. // Frame.Args is invocation values like "(0x14000113040)". Frames []Frame // Creator is the code location of the go statement launching // this thread. // FuncName is "main.main()" for main thread Creator pruntime.CodeLocation }