simple

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parallel

func Parallel[T any](fn func(g *errgroup.Group, returnc chan T) error) (output []T, _ error)

Parallel wraps errgroup, and collects results to an UNORDERED slice. jc: I don't understand ctx enough to return the first error, dismiss results, and kill any running (sub)goroutines.

fn usually consists of a for loop of some kind (ex: bufio.Scanner). Inside the for loop, it shall call g.Go(<something>).

Don't forget to do i, xyz := xyz, hello before g.Go(func() error { return fooBar(i, xyz, returnc) }) (shadowing) https://golang.org/doc/faq#closures_and_goroutines

func RetryOnError

func RetryOnError(backoff wait.Backoff, fn func() (bool, error)) error

RetryOnError uses a bool in the executing function fn to determine if the error is retryable. (instead of a second function, as k8s.retry does)

Types

This section is empty.

Jump to

Keyboard shortcuts

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