Documentation
¶
Overview ¶
Package errgroup provides a Group that is capable of collecting errors as it waits for a collection of goroutines to finish.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMultiError ¶
NewMultiError returns nil if all input errors passed in are nil. Otherwise, it coalesces all input errors into a single error instance. Useful for code like this:
func doThisAndThat() error { err1 := tryThis() err2 := tryThat() return errgroup.NewMultiError(err1, err2) }
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is similar to a sync.WaitGroup, but allows for collecting errors. The collected errors are never reset, so unlike a sync.WaitGroup, this Group can only be used _once_. That is, you may only call Wait on it once.
func (*Group) Add ¶
Add adds delta, which may be negative. See sync.WaitGroup.Add documentation for details.
type MultiError ¶
type MultiError []error
MultiError allows returning a group of errors as one error.
func (MultiError) Error ¶
func (m MultiError) Error() string
Error returns a concatenated string of all contained errors.