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: 1

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