errgroup

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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