Antoine GIRARD 9fe4437bda Use vendored go-swagger (#8087) | vor 5 Jahren | |
---|---|---|
.. | ||
.travis.yml | vor 5 Jahren | |
LICENSE.md | vor 5 Jahren | |
README.md | vor 5 Jahren | |
go.mod | vor 5 Jahren | |
stack.go | vor 5 Jahren |
Package stack implements utilities to capture, manipulate, and format call stacks. It provides a simpler API than package runtime.
The implementation takes care of the minutia and special cases of interpreting the program counter (pc) values returned by runtime.Callers.
Package stack publishes releases via semver compatible Git tags prefixed with a single ‘v’. The master branch always contains the latest release. The develop branch contains unreleased commits.
Package stack’s types implement fmt.Formatter, which provides a simple and flexible way to declaratively configure formatting when used with logging or error tracking packages.
func DoTheThing() {
c := stack.Caller(0)
log.Print(c) // "source.go:10"
log.Printf("%+v", c) // "pkg/path/source.go:10"
log.Printf("%n", c) // "DoTheThing"
s := stack.Trace().TrimRuntime()
log.Print(s) // "[source.go:15 caller.go:42 main.go:14]"
}
See the docs for all of the supported formatting options.