This patch handles nil values when passed into the slice argument of Append(err error, errs ...error). nil values are filtered out and not included in the multierror. When the first argument
to Append is nil, and the second argument consists entirely of nil values, then return a nil value.
This patch allows the usage the following style.
var result error
result = multierror.Append(result, step1())
result = multierror.Append(result, step2())
return result
result will be nil if-and-only-if step1() and step2() both return nil.
I believe this change is backwards compatible. The old behavior when nil values were passed into the slice argument of Append() was to wrap the nil values inside error objects. If this change is not backwards compatible I can revise the patch to instead declare a new function AppendNonNill(err error, errs ...error)
This patch handles nil values when passed into the slice argument of Append(err error, errs ...error). nil values are filtered out and not included in the multierror. When the first argument to Append is nil, and the second argument consists entirely of nil values, then return a nil value.
This patch allows the usage the following style.
result will be nil if-and-only-if step1() and step2() both return nil.
I believe this change is backwards compatible. The old behavior when nil values were passed into the slice argument of Append() was to wrap the nil values inside error objects. If this change is not backwards compatible I can revise the patch to instead declare a new function
AppendNonNill(err error, errs ...error)