This commit is contained in:
2018-12-13 20:33:29 +01:00
parent 7bca21522a
commit d0d888c160
63 changed files with 7546 additions and 2 deletions

21
vendor/github.com/crewjam/errset/README.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
errset is a trivial golang package that implements a slice of errors.
[![Build Status](https://travis-ci.org/crewjam/errset.svg?branch=master)](https://travis-ci.org/crewjam/errset)
[![](https://godoc.org/github.com/crewjam/errset?status.png)](http://godoc.org/github.com/crewjam/errset)
The typical go idiom is to return an `error` or a tuple of (thing, `error`) from functions. This works well if a function performs exactly one task, but
when a function does work which can reasonably partially fail, I found myself writing the same code over and over again. For example:
// CommitBatch commits as many things as it can.
func CommitBatch(things []Thing) error {
errs := errset.ErrSet{}
for _, thing := range things {
err := Commit(thing)
if err != nil {
errs = append(errs, err)
}
}
return errs.ReturnValue() // nil if there were no errors
}