multierror

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 3 modules, 2 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 Builder added in v0.0.11

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

Builder captures errors from parallel goroutines.

Example usage:

var (
	errs = multierror.NewBuilder(3)
	wg   sync.WaitGroup
)
for _, foo := range foos {
	wg.Add(1)
	go func() {
		defer wg.Done()
		errs.Add(someWork(foo))
	}()
}
wg.Wait()
if err := errs.Err(); err != nil {
	// handle err
}

func NewBuilder added in v0.0.11

func NewBuilder(max int) *Builder

func (*Builder) Add added in v0.0.11

func (b *Builder) Add(err error)

Add adds an error to b. b must be non-nil.

func (*Builder) Err added in v0.0.11

func (b *Builder) Err() error

Err returns an error combining all the errors that were already Add-ed. Otherwise returns nil. b may be nil.

Jump to

Keyboard shortcuts

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