Documentation ¶
Overview ¶
Package cleanup provides functionality for executing cleanup functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Nop = func() error { return nil }
Nop is a no-op cleanup.Func.
Functions ¶
This section is empty.
Types ¶
type Cleanup ¶
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup encapsulates a slice of cleanup funcs. The funcs are executed by Run in reverse order to which they are added. Cleanup is safe for concurrent use.
func (*Cleanup) Run ¶
Run executes the cleanup funcs in reverse order to which they were added. All funcs are executed, even in the presence of an error from a func. Any errors are combined into a single error. The set of cleanup funcs is removed when Run returns.
TODO: Consider renaming Run to Close so that Cleanup implements io.Closer?
Click to show internal directories.
Click to hide internal directories.