Documentation
¶
Overview ¶
Package errgroup coordinates goroutines that share a cancellation context.
The first goroutine error cancels the group context and is returned by Wait; recovered panics are converted into errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPanicRecovered = errors.New("errgroup: panic recovered")
ErrPanicRecovered is returned when a goroutine in the group panics.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group manages a set of goroutines that share a cancellation context. The first error returned by any goroutine cancels the group's context and is returned by Wait. Subsequent errors are discarded.
func WithContext ¶
WithContext returns a new Group and a derived context.Context. The derived context is canceled when the first goroutine in the Group returns a non-nil error or when Wait returns, whichever occurs first.
func (*Group) Go ¶
Go starts a new goroutine in the Group. The first non-nil error returned by a goroutine is recorded and triggers cancellation of the group context. Callers must not mutate shared state without synchronization.