Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var E = ErrorHandler{ Out: os.Stderr, PrintStackTrace: true, }
The default error handler
Functions ¶
func Fault ¶
Fault checks if given err is != nil and if it is runs os.Exit(1). This should be used as a top level handling of errors in the main()
func VersionString ¶
VersionString returns a version string that should be printed with the -v or the --version flag. It gets the components from the following keys from the options: program-name program-version program-timestamp
Types ¶
type ErrorHandler ¶
func (*ErrorHandler) Annotate ¶
func (e *ErrorHandler) Annotate(err error, a ...interface{}) error
Annotate increases context information to the error
func (*ErrorHandler) New ¶
func (e *ErrorHandler) New(format string, a ...interface{}) error
New creates a new error variable
func (*ErrorHandler) Panic ¶
func (e *ErrorHandler) Panic(err error, a ...interface{})
func (*ErrorHandler) Print ¶
func (e *ErrorHandler) Print(err error, a ...interface{})
Print writes the error message to predefined io.Writer
type ErrorList ¶
type ErrorList struct { Message string // contains filtered or unexported fields }
ErrorList is a list of errors that can be printed in a single go
func NewErrorList ¶
NewErrorList returns an initialized ErrorList
type Options ¶
type Options interface { Set(key string, value string) Get(key string, fallback string) string IsSet(key string) bool }
Options is an interface to get and set string-like options for components
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
Profiler is a structure to simplify generating CPU and memory profile files from a run of a program.
func SetupProfiler ¶
SetupProfiler sets up an empty profiler with Options. The options should contain keys "profile-cpu-file" which is the file name for the CPU profile. Also the memory profile will be written to value of key "profile-mem-file".