Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Join ¶
Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string.
Types ¶
type ErrWaitGroup ¶
type ErrWaitGroup struct {
// contains filtered or unexported fields
}
A ErrWaitGroup is a collection of goroutines working on subtasks that are part of the same overall task.
A zero ErrWaitGroup is valid, has no limit on the number of active goroutines, and does not cancel on error.
func WithContext ¶
func WithContext(ctx context.Context) (*ErrWaitGroup, context.Context)
WithContext returns a new ErrWaitGroup and an associated Context derived from ctx.
The derived Context is canceled the first time Wait returns.
func (*ErrWaitGroup) Go ¶
func (g *ErrWaitGroup) Go(f func() error)
Go calls the given function in a new goroutine. It blocks until the new goroutine can be added without the number of active goroutines in the group exceeding the configured limit.
func (*ErrWaitGroup) SetLimit ¶
func (g *ErrWaitGroup) SetLimit(n int)
SetLimit limits the number of active goroutines in this group to at most n. A negative value indicates no limit.
Any subsequent call to the Go method will block until it can add an active goroutine without exceeding the configured limit.
The limit must not be modified while any goroutines in the group are active.
func (*ErrWaitGroup) TryGo ¶
func (g *ErrWaitGroup) TryGo(f func() error) bool
TryGo calls the given function in a new goroutine only if the number of active goroutines in the group is currently below the configured limit.
The return value reports whether the goroutine was started.
func (*ErrWaitGroup) Wait ¶
func (g *ErrWaitGroup) Wait() error
Wait blocks until all function calls from the Go method have returned, then returns the combined non-nil errors (if any) from them.