util

package module
v0.0.0-...-20ece0e Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT, Unlicense Imports: 2 Imported by: 0

README

This package provides utility functions for use in Go projects.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendErr

func AppendErr(err, other error) error

AppendErr an error to another, forming a list.

func Collect

func Collect[T any](ch chan T) (out []T)

Collect buffers values from a channel until closed, returning a slice containing the values.

func Fanout

func Fanout(n int, fn func(int) error) error

Fanout will do an n-wide Fanout invoking the provided function with the current index.

After the Fanout completes any errors will be coalesced into a single error value.

The caller can decide if errors are fatal.

Inspect the errors by asserting to []error.

func For

func For(n int, fn func(int) error) (errs error)

For executes a serialized n-wide fanout invoking the provided function with the current index.

Types

type Errors

type Errors []error

Errors represents a list of errors as a single error.

func (Errors) Error

func (errs Errors) Error() string

func (Errors) Pretty

func (errs Errors) Pretty() string

Pretty breaks errors over newlines.

func (Errors) String

func (errs Errors) String() string

Jump to

Keyboard shortcuts

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