As of Go 1.20, the standard library supposedly contains infrastructure for reporting multiple errors.
Sadly, that infrastructure is mostly unhelpful: errors.Join gives no control over formatting, and fmt.Errorf does not support a []error input. So, introduce our own multierr.Format, and use it where possible.
Then remove the go-multierror dependency. The net result is not particularly better code, but at least we try to work with the standard library design.
(This was originally motivated just by trying to remove the go-multierror dependency in #2364, now that the standard library supposedly supports the feature.)
This might, in some cases, change whether the returned error matches errors.{As,Is}, mostly because the previous code for aggregating multiple errors was written before Go 1.20 made it possible for multiple errors to match. (Not that I know how the multi-matching design can ever be all that useful…)
As of Go 1.20, the standard library supposedly contains infrastructure for reporting multiple errors.
Sadly, that infrastructure is mostly unhelpful:
errors.Join
gives no control over formatting, andfmt.Errorf
does not support a[]error
input. So, introduce our ownmultierr.Format
, and use it where possible.Then remove the
go-multierror
dependency. The net result is not particularly better code, but at least we try to work with the standard library design.(This was originally motivated just by trying to remove the
go-multierror
dependency in #2364, now that the standard library supposedly supports the feature.)This might, in some cases, change whether the returned error matches
errors.{As,Is}
, mostly because the previous code for aggregating multiple errors was written before Go 1.20 made it possible for multiple errors to match. (Not that I know how the multi-matching design can ever be all that useful…)See individual commit messages for details.