cleanup

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOnSignal

func CleanupOnSignal(cf *CleanupFunctions, exitCode int, sig ...os.Signal)

CleanupOnSignal will call the HardCleanup() method for the specified cleanup functions when one of the specified signals is caught and then exits the programme with the specified exitCode.

Types

type CleanupFunctions

type CleanupFunctions struct {
	// contains filtered or unexported fields
}

func NewCleanupFunctions

func NewCleanupFunctions(logger log.DebugLogger) *CleanupFunctions

NewCleanupFunctions creates a container for cleanup functions.

func (*CleanupFunctions) Add

func (cf *CleanupFunctions) Add(fn Function)

Add will a function to the list of cleanup functions.

func (*CleanupFunctions) Cleanup

func (cf *CleanupFunctions) Cleanup() error

Cleanup will call all the cleanup functions, starting with the last added (LIFO). If any function returns an error, the cleanup will be terminated early and it's error will be returned.

func (*CleanupFunctions) HardCleanup

func (cf *CleanupFunctions) HardCleanup() error

HardCleanup will call all the cleanup functions, starting with the last added (LIFO). If any function returns an error it is logged, but cleanup will continue regardless. The error of the first function which returns an error will be returned.

type Function

type Function func() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL