Documentation
¶
Overview ¶
Package errgroup is a Go package that provides Context cancellation, error propagation and synchronisation for goroutines running fallible functions.
Index ¶
Constants ¶
const Version = "0.0.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelError ¶
type CancelError struct{}
CancelError indicates that the Group has been cancelled.
func (CancelError) Error ¶
func (c CancelError) Error() string
type Configurer ¶
type Configurer interface {
// contains filtered or unexported methods
}
Configurer configures the behaviour of a Group.
func WithCancel ¶
func WithCancel(ctx context.Context) (context.Context, Configurer)
WithCancel returns a context.Context (derived from ctx) and a Configurer. The returned Configurer configures a Group to cancel the derived context.Context when:
- The first time a function passed to Group.Go returns a non-nil error.
- The first time a call to Group.Wait returns.
func WithRunner ¶
func WithRunner(runner Runner) Configurer
WithRunner returns a Configurer that configures a Group to run every f supplied to Group.Go using the supplied Runner.
type GoRunner ¶
type GoRunner struct{}
GoRunner is a Runner that runs f in another goroutine that was spawned using the `go` keyword.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group manages the execution of fallible functions i.e. functions of type func() error.
func New ¶
func New(configurers ...Configurer) *Group
New returns a new Group that has been configured by applying the supplied Configurer's.