A Go package for representing multiple errors as a single error with custom formatting and concurrent error collection.
go-multierror is a Go package that allows developers to represent multiple errors as a single error value. It solves the problem of functions needing to return more than one error by providing aggregation, custom formatting, and concurrent error collection utilities. While Go 1.20 introduced `errors.Join` for basic error combining, go-multierror offers additional features like the `Group` pattern and custom formatting options.
Go developers building applications that require robust error handling, especially those working with concurrent operations or needing to aggregate multiple validation or processing errors.
Developers choose go-multierror for its seamless integration with existing Go error patterns, support for concurrent error collection, and custom formatting capabilities that go beyond the standard library's `errors.Join`.
A Go (golang) package for representing a list of errors as a single error.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a Group pattern to collect all errors from multiple goroutines, ensuring no failures are lost, which is not directly available in the standard library's errgroup.
Allows setting a custom ErrorFormat function to tailor combined error messages, offering more control than errors.Join's default format.
Supports errors.As, errors.Is, and errors.Unwrap, making it compatible with existing Go error handling patterns without breaking changes.
The Append function works with nil or any error type, enabling easy integration into legacy codebases without major refactoring.
Go 1.20's errors.Join covers basic error aggregation, making go-multierror less essential for new projects, as noted in the README's recommendation.
Implementing the Group pattern requires additional code compared to using simpler concurrency primitives or wrapping errors.Join with mutexes.
Uses chained Unwrap that returns errors one at a time, unlike errors.Join's Unwrap() []error, which can be less efficient for error introspection in modern Go.