Jay Taylor's notes
back to listing indexPackage errgroup
[web search]package errgroup
import "golang.org/x/sync/errgroup"
Package errgroup provides synchronization, error propagation, and Context cancelation for groups of goroutines working on subtasks of a common task.
Index
Examples
Package Files
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 WithContext
WithContext returns a new Group and an associated Context derived from ctx.
The derived Context is canceled the first time a function passed to Go returns a non-nil error or the first time Wait returns, whichever occurs first.
func (*Group) Go
Go calls the given function in a new goroutine.
The first call to return a non-nil error cancels the group; its error will be returned by Wait.
func (*Group) Wait
Wait blocks until all function calls from the Go method have returned, then returns the first non-nil error (if any) from them.
Package errgroup imports 2 packages (graph) and is imported by 127 packages. Updated 13 days ago. Refresh now. Tools for package owners.