but

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 4 Imported by: 0

README

GoDoc

But

but is a Go package that provides helpers for handling messages while at the bottom of the call stack.

Documentation

Overview

The but package provides helpers for handling messages while at the bottom of the call stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(args ...interface{})

Fail prints the given arguments to stderr and exits.

func Failf

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

Failf formats the arguments according to format, prints the result to stderr, and exits.

func IfError

func IfError(err error, args ...interface{}) bool

IfError prints err to stderr if the error is non-nil. Extra arguments are converted to a string which, if present, annotates the error. Returns true if the error is non-nil.

func IfErrorf

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

IfErrorf prints err to stderr if the err is non-nil. Extra arguments are formatted as a string, according to the format argument. If present, this string annotates the error. Returns true if the error is non-nil.

func IfFatal

func IfFatal(err error, args ...interface{})

IfFatal prints err to stderr and exits, if the error is non-nil. Extra arguments are converted to a string which, if present, annotates the error.

func IfFatalf

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

IfFatalf prints err to stderr and exits, if the err is non-nil. Extra arguments are formatted as a string, according to the format argument. If present, this string annotates the error.

func Log

func Log(args ...interface{})

Log prints the given arguments to stderr.

func Logf

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

Logf formats the arguments according to format, and prints the result to stderr.

Types

type Errors

type Errors struct {
	// Msg is an optional message to be displayed before the list of errors.
	Msg string
	// Errs is the list of errors.
	Errs []error
}

Errors groups together multiple errors as a single error.

func (Errors) Error

func (err Errors) Error() string

Error implements the error interface. Errors are displayed one per line, each with indentation.

func (Errors) Errors

func (err Errors) Errors() []error

Errors returns the list of errors.

Jump to

Keyboard shortcuts

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