errgroup

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: BSD-3-Clause Imports: 4 Imported by: 4

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. It collects possible errors returned from the subtasks.

func WithContext

func WithContext(ctx context.Context) (*Group, context.Context)

WithContext returns a new Group and an associated context.Context derived from ctx. Unlike golang.org/x/sync/errgroup.Group, the derived context is not canceled the first time a function passed to Group.Go returns a non-nil error.

func (*Group) ErrorList

func (g *Group) ErrorList() *errlist.List

ErrorList returns a List of collected errors from the called goroutines.

func (*Group) Go

func (g *Group) Go(fn func() error)

Go calls the given function in a new goroutine. Errors from all calls are collected, combined 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 all collected errors as a (multi) error.

Jump to

Keyboard shortcuts

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