Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentBinary ¶
func CurrentBinary() string
CurrentBinary gives the name of the executable running the current Go code
func GetSourceCodeRef ¶
func GetSourceCodeRef(skip int, config StackConfig) string
GetSourceCodeRef returns the callers source code reference
func GetStackTrace ¶
func GetStackTrace(skip int, config StackConfig) []string
GetStackTrace returns a rendered stacktrace of the calling code, skipping `skip` frames in the stack prior to this function
func GetStackTraceLegacy ¶
GetStackTraceLegacy returns a rendered stacktrace of the calling code, skipping `skip` frames in the stack (1 is the GetStackTrace frame itself). Deprecated: use GetStackTrace
func PackagePath ¶
PackagePath returns the package path for a type this will panic for any nil-like object Typically you would use this with a struct, such as testing.T or http.Server
Types ¶
type StackConfig ¶
type StackConfig struct {
// RemoveLambdas will remove anonymous functions from the call stack
RemoveLambdas bool
// PackagesShown, if not empty, will limit the call stack to functions from these packages
PackagesShown []string
// PackagesHidden will remove any calls in the stack from these packages
// If a call matches a package in PackagesShown and PackagesHidden, it will be shown
PackagesHidden []string
// TrimRuntime will remove entries from the Go runtime
TrimRuntime bool
// FormatStack is the format for lines in the stack trace
// The default will print the source reference and the function name
FormatStack func(stack.Call) string
// FormatReference is the formatter used when creating source code references
FormatReference func(stack.Call) string
}
Click to show internal directories.
Click to hide internal directories.