August 2016
Beginner to intermediate
665 pages
14h 11m
English
In an effort to capture stack traces directly, we can glean some helpful pieces of information from the built-in runtime package.
Specifically, Go provides a couple of tools to give us insight into the invocation and/or breakpoints of a goroutine. The following are the functions within the runtime package:
runtime.Caller(): This returns information about the parent function of a goroutineruntime.Stack(): This allocates a buffer for the amount of data in a stack trace and then fills that with the traceruntime.NumGoroutine(): This returns the total number of open goroutinesWe can utilize all three preceding tools to better describe the inner workings of any given goroutine and related errors.
Using ...
Read now
Unlock full access