exithook
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package exithook provides limited support for on-exit cleanup.
CAREFUL! The expectation is that Add should only be calledfrom a safe context (e.g. not an error/panic path or signalhandler, preemption enabled, allocation allowed, write barriersallowed, etc), and that the exit function F will be invoked undersimilar circumstances. That is the say, we are expecting that Fuses normal / high-level Go code as opposed to one of the morerestricted dialects used for the trickier parts of the runtime.
Index¶
Constants¶
This section is empty.
Variables¶
var (// runtime sets these for usGosched func()Goid func()uint64Throw func(string))
Functions¶
Types¶
typeHook¶
type Hook struct {F func()// func to runRunOnFailurebool// whether to run on non-zero exit code}
A Hook is a function to be run at program termination(when someone invokes os.Exit, or when main.main returns).Hooks are run in reverse order of registration:the first hook added is the last one run.