package task

Import Path
	go.pact.im/x/task (on go.dev)

Dependency Relation
	imports 4 packages, and imported by one package

Involved Source Files cond.go context.go executor.go Package task provides an alternative to errgroup package with builtin context cancellation support. This packages uses go.uber.org/multierr to combine errors from failed tasks.
Package-Level Type Names (total 4, in which 3 are exported)
/* sort exporteds by: | */
CancelCondition is a condition for canceling the task group. func CancelOnError() CancelCondition func CancelOnReturn() CancelCondition func NeverCancel() CancelCondition func Parallel(cond CancelCondition, tasks ...Task) Task func Sequential(cond CancelCondition, tasks ...Task) Task func Executor.Execute(ctx context.Context, cond CancelCondition, tasks ...Task) error
Executor abstracts the execution order for task groups. ( Executor) Execute(ctx context.Context, cond CancelCondition, tasks ...Task) error func ParallelExecutor() Executor func SequentialExecutor() Executor
Task is a function that performs some work in foreground. Run executes the task. func Contextify(task func() error, shutdown func()) Task func Named(name string, run Task) Task func Parallel(cond CancelCondition, tasks ...Task) Task func Sequential(cond CancelCondition, tasks ...Task) Task func Named(name string, run Task) Task func Parallel(cond CancelCondition, tasks ...Task) Task func Sequential(cond CancelCondition, tasks ...Task) Task func Executor.Execute(ctx context.Context, cond CancelCondition, tasks ...Task) error
Package-Level Functions (total 12, in which 9 are exported)
CancelOnError indicates that task group should return on non-nil error. This is the same behavior as the golang.org/x/sync/errgroup package.
CancelOnReturn indicates that task group should be canceled if any subtask returns.
Contextify adds context cancellation support to the task using the given shutdown function.
Named returns a task that returns an error prefixed with name on failure.
NeverCancel indicates that task group should not be canceled until all subtasks complete.
Parallel returns a function that executes a group of tasks in parallel using the given cancellation condition. The resulting Task returns combined errors for all failed subtasks.
ParallelExecutor returns an Executor instance for parallel execution.
Sequential returns a function that executes a group of tasks sequentially using the given cancellation condition. The resulting Task returns combined errors for all failed subtasks.
SequentialExecutor returns an Executor instance for sequential execution.
Package-Level Variables (total 2, neither is exported)