const _defaultBufferSize … type Stack … // ID returns the goroutine ID. func (s Stack) ID() int { … } // State returns the Goroutine's state. func (s Stack) State() string { … } // Full returns the full stack trace for this goroutine. func (s Stack) Full() string { … } // FirstFunction returns the name of the first function on the stack. func (s Stack) FirstFunction() string { … } // HasFunction reports whether the stack has the given function // anywhere in it. func (s Stack) HasFunction(name string) bool { … } func (s Stack) String() string { … } func getStacks(all bool) []Stack { … } type stackParser … func newStackParser(r io.Reader) *stackParser { … } func (p *stackParser) Parse() ([]Stack, error) { … } // parseStack parses a single stack trace from the given scanner. // line is the first line of the stack trace, which should look like: // // goroutine 123 [runnable]: func (p *stackParser) parseStack(line string) (Stack, error) { … } // All returns the stacks for all running goroutines. func All() []Stack { … } // Current returns the stack for the current goroutine. func Current() Stack { … } func getStackBuffer(all bool) []byte { … } // Parses a single function from the given line. // The line is in one of these formats: // // example.com/path/to/package.funcName(args...) // example.com/path/to/package.(*typeName).funcName(args...) // created by example.com/path/to/package.funcName // created by example.com/path/to/package.funcName in goroutine [...] // // Also reports whether the line was a "created by" line. func parseFuncName(line string) (name string, creator bool, err error) { … } // parseGoStackHeader parses a stack header that looks like: // goroutine 643 [runnable]:\n // And returns the goroutine ID, and the state. func parseGoStackHeader(line string) (goroutineID int, state string, err error) { … }