I was following tutorial from JustForFunc episode 22
Added those two lines at the start of main() in main.go:
trace.Start(os.Stdout)
defer trace.Stop()
build the binary using go build -o appName
Timed it with time ./appName > m.trace
And finally tried to open trace with go tool trace m.trace
but got following error:
2017/11/10 19:15:38 Parsing trace...
failed to parse trace: unknown event type 50 at offset 0x16
Little more background on my code(golang 1.9, linux) : it is a server for GET requests built with gin-gonic. I added extra line of code time.AfterFunc(20*time.Seconds, func(){closeServer()})
to close my server after 20 seconds so I could make few request to it and then stop server exiting program.