Documentation ¶
Index ¶
- Variables
- func As(err error, target any) bool
- func Exif(pred bool, fmtArgs ...any)
- func Exit(code int, fmtArgs ...any)
- func Fmt(format string) func(...any) error
- func GetOutput() io.Writer
- func HaveNeedc[T comparable](have, want T) error
- func HaveNeedf[T any](eq func(T, T) bool, have, want T) error
- func HaveWant(have, want any) error
- func Is(err, target error) bool
- func Join(errs ...error) error
- func LST(arg string) bool
- func Must(err error, fmtArgs ...any)
- func MustBool(pred bool, fmtArgs ...any)
- func Mustv[T any](val T, err error, fmtArgs ...any) T
- func Mustv2[I, O any](fn func(I) (O, error), fmtArgs ...any) func(I) O
- func New(msg string, fmtArgs ...any) error
- func ParseArgs(args ...any) (code *int, msg *string, rem []any)
- func SetOutput[T Writer](dst T)
- func Should(err error) bool
- func ShouldBool(pred bool, fmtArgs ...any) bool
- func Strr(arg any) string
- func Strrf(arg any, format string) string
- func Unwrap(err error) error
- type FmtArgs
- type Note
- type Writer
Constants ¶
This section is empty.
Variables ¶
var Separator rune = '=' // used by Must to separate output
Functions ¶
func As ¶
As finds the first error in err's chain that matches target, and if one is found, sets target to that error value and returns true. Otherwise, it returns false.
func Exif ¶
Exif calls os.Exit if pred == true, which implies err != nil see go doc but FmtArgs for more info
func Exit ¶
Exif calls os.Exit and, optionally, logs a message to the output see go doc but FmtArgs for more info
func HaveNeedc ¶
func HaveNeedc[T comparable](have, want T) error
HaveNeedf produces "want, have" error if the two values are not equal nil otherwise see go doc but Template for more general use cases
func HaveNeedf ¶
HaveNeedf produces "want, have" error see go doc but Template for more general use cases
func HaveWant ¶
HaveWant produces "want, have" error in cases where difference is already known see go doc but Template for more general use cases
func Join ¶
Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string.
func Mustv ¶
Mustv unpacks the return value of a function that might fail panicking if it does
Mustv(myfunc(...))
see go doc but FmtArgs for more info
func New ¶
Error is a errors.New && fmt.Errorf hybrid. returns nil if text is empty string seen go doc but FmtArgs for more info
func ParseArgs ¶
ParseArgs parses an []any in accordance with the FmtArgs constraint see go doc but FmtArgs for more info
func SetOutput ¶
func SetOutput[T Writer](dst T)
SetOutput configures the io.Writer to which all logs are made
func ShouldBool ¶ added in v1.0.1
prints to stderr if pred is true see go doc but FmtArgs for more info
Types ¶
type Note ¶
type Note string
func (Note) Exif ¶
Exif much like exit, except that it will only exit if the underlying string is empty accepts format parameters as described in the but.FmtArgs interface