Documentation ¶
Index ¶
Constants ¶
View Source
const ( Default = iota // Default Testing // Testing )
Variables ¶
This section is empty.
Functions ¶
func UsageDefault ¶
func UsageDefault() *string
Types ¶
type AppHelper ¶
type AppHelper struct {
// contains filtered or unexported fields
}
Helper for exits and errors. mode can be one of Default or Testing.
var App AppHelper
Assigned in main
func (*AppHelper) Errors ¶
Check if an error was generated and run a callback. If err is nil the function returns.
Print a standard error and exit:
a := AppHelper{} err := errors.New("More cowbell") a.Errors(err, nil)
Custom code on error:
errcnt := 0 efunc := func(err error) { e := fmt.Errorf("Got error: %v", err) log.Printf("%v", e) errcnt = errcnt + 1 } err := SomeFunction() a.Errors(err, efunc) log.Printf("Error count: %d", errcnt)
Click to show internal directories.
Click to hide internal directories.