Closed sethvargo closed 1 year ago
Right now, we depend on hashicorp/go-multierror:
var merr *multierror.Error merr = multierror.Append(merr, fmt.Errorf("..."))
With Go 1.20, we can use the native multi-error:
var merr err err = errors.Join(err, fmt.Errorf("..."))
errors.Join discards nil errors, so it's also great for use with named returns:
errors.Join
nil
func doThing() (err error) { err = errors.Join(err, foo()) err = errors.Join(err, bar()) return }
No response
N/A
TL;DR
Right now, we depend on hashicorp/go-multierror:
With Go 1.20, we can use the native multi-error:
errors.Join
discardsnil
errors, so it's also great for use with named returns:Expected behavior
No response
Observed behavior
No response
Environment Details
Additional information
No response