Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoFunc = errors.New("no call stack information")
ErrNoFunc means that the Call has a nil *runtime.Func. The most likely cause is a Call with the zero value.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
// contains filtered or unexported fields
}
Call records a single function invocation from a goroutine stack.
func Caller ¶
Caller returns a Call from the stack of the current goroutine. The argument skip is the number of stack frames to ascend, with 0 identifying the calling function.
func CallerIgnore ¶
func (Call) Format ¶
Format implements fmt.Formatter with support for the following verbs.
%s source file %d line number %n function name %k last segment of the package path %v equivalent to %s:%d
It accepts the '+' and '#' flags for most of the verbs as follows.
%+s path of source file relative to the compile time GOPATH, or the module path joined to the path of source file relative to module root %#s full path of source file %+n import path qualified function name %+k full package path %+v equivalent to %+s:%d %#v equivalent to %#s:%d
func (Call) MarshalText ¶
MarshalText implements encoding.TextMarshaler. It formats the Call the same as fmt.Sprintf("%v", c).
type CallStack ¶
type CallStack []Call
CallStack records a sequence of function invocations from a goroutine stack.
func Trace ¶
func Trace() CallStack
Trace returns a CallStack for the current goroutine with element 0 identifying the calling function.
func (CallStack) Format ¶
Format implements fmt.Formatter by printing the CallStack as square brackets ([, ]) surrounding a space separated list of Calls each formatted with the supplied verb and options.
func (CallStack) MarshalText ¶
MarshalText implements encoding.TextMarshaler. It formats the CallStack the same as fmt.Sprintf("%v", cs).
func (CallStack) TrimAbove ¶
TrimAbove returns a slice of the CallStack with all entries above c removed.
func (CallStack) TrimBelow ¶
TrimBelow returns a slice of the CallStack with all entries below c removed.
func (CallStack) TrimRuntime ¶
TrimRuntime returns a slice of the CallStack with the topmost entries from the go runtime removed. It considers any calls originating from unknown files, files under GOROOT, or _testmain.go as part of the runtime.