Documentation
¶
Overview ¶
Contains common structure handles errors in CausedBy way in command line utility applications.
Service/daemon can use cmdline package to handle main goroutine's panic/errors, but can not handle panic/errors inside other goroutines, use redforks/life package to cover service goroutines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Go ¶
func Go(main MainFunc)
Call your application main function, handles any error returned or paniced, handle error by errors.CausedBy rule.
func NewExitError ¶
Create a new exit error. Panic with exit error or return it in MainFunc, Go() detect it and call os.Exit() with specific exit code. os.Exit() exit the application immediately without calling deferred code block, by using exit error we can *fix* this.