v0.4.0
New packages:
async
: The new async
package provides functionality for working with async operations. It provides the Group
type which can be used to execute a list of related operations in parallel and collect the results.
Minor Changes:
progress
:
- Added
ContextWithTrackerUsingKey
andTrackerFromContextUsingKey
which work the same asContextWithTracker
andTrackerFromContext
but allow setting a custom context key. - Added
RunOptions.TrackerKey
andRunParallelOptions.TrackerKey
which can be used to specify the key to use to retrieve theTracker
from the context. RunParallel/RunParallelT
now return results in the same order that they were run. These semantics are documented in the godoc and are part of the API contract now.
Breaking Changes:
command
:
Command.Exec
andExec
now require acontext.Context
as the first parameter. This context is used to kill the command process if the context becomes done before the process completes on its own.
progress
:
Run/RunT
andRunParallel/RunParallelT
no longer return immediately if the context becomes done but rather wait for the running functions to complete. This behaviour was deemed undesirable as it meant that operations were still running concurrently afterRun/RunParallel
returned which might be unexpected. The semantics now are that whenRun/RunParallel
return, there are no concurrent operations running. It is up to callers to ensure that their functions use the context properly to handle timeouts/cancellations.RunParallel/RunParallelT
no longer return immediately ifCancelOnError
is true but wait for the running functions to complete for the same reasons as describe in the previous point.