type Hook … var locked … var runGoid … var hooks … var running … var Gosched … var Goid … var Throw … // Add adds a new exit hook. func Add(h Hook) { … } // Run runs the exit hooks. // // If an exit hook panics, Run will throw with the panic on the stack. // If an exit hook invokes exit in the same goroutine, the goroutine will throw. // If an exit hook invokes exit in another goroutine, that exit will block. func Run(code int) { … } type exitError … func (e exitError) Error() string { … }