common

package
v0.0.0-...-08faef4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 7 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Quiet = false

	DebugEnabled   = false
	VerboseEnabled = false
)

Functions

func AtExit

func AtExit(f ExitFunc)

AtExit registers an at-exit hook function.

func Check

func Check(err error, message string)

func CheckPanic

func CheckPanic(err error, message string)

func CheckPanice

func CheckPanice(err error)

func CheckPanicf

func CheckPanicf(err error, format string, args ...interface{})

func Checke

func Checke(err error)

func Checkf

func Checkf(err error, format string, args ...interface{})

func Debug

func Debug(message string)

func Debugf

func Debugf(format string, args ...interface{})

func Dump

func Dump(prefix string, object interface{})

func Exit

func Exit(success bool)

Exit should be used within RunAndExit to cleanly finishes the process.

func ExitFailure

func ExitFailure()

ExitFailure should be used within RunAndExit to cleanly finishes the process with a failure code.

func ExitSuccess

func ExitSuccess()

ExitSuccess should be used within RunAndExit to cleanly finishes the process with a success code.

func ExitWithStatus

func ExitWithStatus(status int)

ExitWithStatus should be used within RunAndExit to cleanly finishes the process with a given status code.

func Fatal

func Fatal(message string)

func Fatalf

func Fatalf(format string, args ...interface{})

func GetBinEnv

func GetBinEnv(suffix string) string

func MustGetBinName

func MustGetBinName() string

MustGetBinName returns the filename of the currently running executable.

func MustGetExecutable

func MustGetExecutable() string

MustGetExecutable returns the filename of the self binary.

func MustGetHome

func MustGetHome() string

MustGetHome returns the home directory path.

func MustGetenv

func MustGetenv(name string) string

func OrFatalf

func OrFatalf(condition bool, format string, args ...interface{})

func OrPanicf

func OrPanicf(condition bool, format string, args ...interface{})

func OrWarnf

func OrWarnf(condition bool, format string, args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func RunAndExit

func RunAndExit(f func() int)

RunAndExit executes a given function. Within the function, util.Exit* functions can be used to finish the process cleanly.

func RunAndExitIfFailure

func RunAndExitIfFailure(f func() int)

RunAndExitIfFailure executes a given function. Within the function, util.Exit* functions can be used to finish the process cleanly. When f returns 0, then this fucntion will *not* call exit(1).

func RunAtExits

func RunAtExits()

RunAtExits runs (and removes) all registered AtExit functions. RunAndExit will call it automatically, so no need to call it when you use RunAndExit.

func Verbose

func Verbose(message string)

func Verbosef

func Verbosef(format string, args ...interface{})

func Warn

func Warn(message string)

func Warnf

func Warnf(format string, args ...interface{})

Types

type ExitFunc

type ExitFunc func()

Jump to

Keyboard shortcuts

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