Package multierr provides an idiomatic Append function for errors, allowing to combine multiple errors into one. Basically the whole API is: Among other use cases, this is especially useful in failable deferred funcs to avoid silently ignoring cleanup errors: Unlike many other multierror packages, this one does not even expose its multierror type, and will only use it when you actually end up with more than a single error to return. The returned multierror type supports errors.Is and errors.As by delegating to each of the suberrors it contains.

go get