RosettaCodeData/Task/Stack-traces/Go/stack-traces.go
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

14 lines
256 B
Go

package main
import (
"fmt"
"runtime/debug"
)
func main() {
// to print it to standard error
debug.PrintStack()
// alternately to get it in a variable:
stackTrace := debug.Stack()
fmt.Printf("(%d bytes)\n", len(stackTrace))
}