commit | 60a318af5f3acfdfa3cb247aa29fbcdbb3ac12b6 | [log] [tgz] |
---|---|---|
author | Abhinav Gupta <abg@uber.com> | Mon Nov 04 10:23:04 2019 -0800 |
committer | GitHub <noreply@github.com> | Mon Nov 04 10:23:04 2019 -0800 |
tree | c590d014235c41a76b3c367f1ec49aa19dab0abe | |
parent | c3fc3d02ec864719d8e25be2d7dde1e35a36aa27 [diff] |
Add AppendInto function (#31) This adds an AppendInto function that behaves similarly to Append except, it operates on a `*error` on the left side and it reports whether the right side error was non-nil. func AppendInto(*error, error) (errored bool) Making the left side a pointer aligns with the fast path of `Append`. Returning whether the right error was non-nil aligns with the standard `if err := ...; err != nil` pattern. ```diff -if err := thing(); err != nil { +if multierr.AppendInto(&err, thing()) { continue } ``` Resolves #21
multierr
allows combining one or more Go error
s together.
go get -u go.uber.org/multierr
Stable: No breaking changes will be made before 2.0.
Released under the MIT License.