// New returns an error with the supplied message. // New also records the stack trace at the point it was called. func New(message string) error { … } // Errorf formats according to a format specifier and returns the string // as a value that satisfies error. // Errorf also records the stack trace at the point it was called. func Errorf(format string, args ...interface{ … } type fundamental … func (f *fundamental) Error() string { … } func (f *fundamental) Format(s fmt.State, verb rune) { … } // WithStack annotates err with a stack trace at the point WithStack was called. // If err is nil, WithStack returns nil. func WithStack(err error) error { … } type withStack … func (w *withStack) Cause() error { … } // Unwrap provides compatibility for Go 1.13 error chains. func (w *withStack) Unwrap() error { … } func (w *withStack) Format(s fmt.State, verb rune) { … } // Wrap returns an error annotating err with a stack trace // at the point Wrap is called, and the supplied message. // If err is nil, Wrap returns nil. func Wrap(err error, message string) error { … } // Wrapf returns an error annotating err with a stack trace // at the point Wrapf is called, and the format specifier. // If err is nil, Wrapf returns nil. func Wrapf(err error, format string, args ...interface{ … } // WithMessage annotates err with a new message. // If err is nil, WithMessage returns nil. func WithMessage(err error, message string) error { … } // WithMessagef annotates err with the format specifier. // If err is nil, WithMessagef returns nil. func WithMessagef(err error, format string, args ...interface{ … } type withMessage … func (w *withMessage) Error() string { … } func (w *withMessage) Cause() error { … } // Unwrap provides compatibility for Go 1.13 error chains. func (w *withMessage) Unwrap() error { … } func (w *withMessage) Format(s fmt.State, verb rune) { … } // Cause returns the underlying cause of the error, if possible. // An error value has a cause if it implements the following // interface: // // type causer interface { // Cause() error // } // // If the error does not implement Cause, the original error will // be returned. If the error is nil, nil will be returned without further // investigation. func Cause(err error) error { … }