Like this:
package main
import (
"os"
"runtime/pprof"
)
func main() {
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
}
The output:
$ go run main.go
goroutine profile: total 1
1 @ 0x10ad368 0x10ad170 0x10a9bd4 0x10b3ee5 0x102a407 0x1052dc1
# 0x10ad367 runtime/pprof.writeRuntimeProfile+0x97 /usr/local/go/src/runtime/pprof/pprof.go:707
# 0x10ad16f runtime/pprof.writeGoroutine+0x9f /usr/local/go/src/runtime/pprof/pprof.go:669
# 0x10a9bd3 runtime/pprof.(*Profile).WriteTo+0x3e3 /usr/local/go/src/runtime/pprof/pprof.go:328
# 0x10b3ee4 main.main+0x64 /Users/inanc/go/src/github.com/inancgumus/main.go:9
# 0x102a406 runtime.main+0x206 /usr/local/go/src/runtime/proc.go:201