multierror and multilogger cleaned up.

This commit is contained in:
2022-01-05 16:36:20 -05:00
parent 4addc44c0f
commit ef0a4d825d
3 changed files with 59 additions and 15 deletions

View File

@@ -25,7 +25,7 @@ Example:
}
if errs != nil && len(errs) != 0 {
// err now contains multiple errors presented as a single error.
// err now contains multiple errors presented as a single error interface.
err = multierr.NewErrors(errs...)
}
}
@@ -50,7 +50,12 @@ MultiError also has a shorthand, making the above much less verbose:
}
}()
}
// multierror now contains any/all errors above.
// multierror now contains any/all errors above. If calling in a function, you'll probably want to do:
// if !multierror.IsEmpty() {
// err = multierror
// }
}
In the above, the multierror assignment can still be used as an error.