https://github.com/benbjohnson/stack
Go debug/stack utility functions.
https://github.com/benbjohnson/stack
Last synced: 9 months ago
JSON representation
Go debug/stack utility functions.
- Host: GitHub
- URL: https://github.com/benbjohnson/stack
- Owner: benbjohnson
- License: mit
- Created: 2020-10-09T15:30:46.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-09T17:36:19.000Z (over 5 years ago)
- Last Synced: 2025-04-02T21:05:50.168Z (9 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 18
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stack
Go debug/stack utility functions and command line interfaces.
## CLI
### stack-minify
The `stack-minify` CLI command accepts text through STDIN and converts all lines
which have a two-line stack entry format to a single-line minified format.
```sh
$ cat mystack.txt | stack-minify
```
### Utility functions
## Minify()
The `stack.Minify()` function accepts the output of `debug.Stack()` and returns
a compact version that shows one stack entry per line. Function variables and
offsets are removed so it only shows the package, function, filename, & line
number.
```
stack.Minify(debug.Stack())
```
```
Input:
goroutine 61 [running]:
runtime/debug.Stack(0xd, 0xd, 0x4f44328)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
github.com/benbjohnson/stack/v2/foo.(*Bar).baz(0xc000c6a5b0, 0x4e00001, 0x0, 0x0, 0x0)
/src/stack/benbjohnson/stack/foo.go:579 +0x7e
```
```
Output:
goroutine 61 [running]:
runtime/debug.Stack(): stack.go:24
github.com/benbjohnson/stack/v2/foo.(*Bar).baz(): foo.go:579
```