errgroup

package
v0.0.0-...-d8f8204 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	// contains filtered or unexported fields
}

A Group is a collection of goroutines working on subtasks that are part of the same overall task.

A zero Group is valid and does not cancel on error.

func WithNErrs

func WithNErrs(nerrs int) *Group

WithNErrs returns a new Group with length of errs slice upto nerrs, upon Wait() errors are returned collected from all tasks.

func (*Group) Go

func (g *Group) Go(f func() error, index int)

Go calls the given function in a new goroutine.

The first call to return a non-nil error will be collected in errs slice and returned by Wait().

func (*Group) Wait

func (g *Group) Wait() []error

Wait blocks until all function calls from the Go method have returned, then returns the slice of errors from all function calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL