0cfea47d87
Bumps the github-actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `4.2.1` | `4.2.2` | | [github/codeql-action](https://github.com/github/codeql-action) | `3.26.13` | `3.27.4` | | [actions/dependency-review-action](https://github.com/actions/dependency-review-action) | `4.3.4` | `4.4.0` | | [actions/setup-go](https://github.com/actions/setup-go) | `5.0.2` | `5.1.0` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `4.6.0` | `5.0.2` | Updates `actions/checkout` from 4.2.1 to 4.2.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits]( |
||
---|---|---|
.github | ||
.gitignore | ||
.pre-commit-config.yaml | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
after_both.go | ||
after_both_test.go | ||
continue_with.go | ||
continue_with_test.go | ||
error_test.go | ||
go.mod | ||
go.sum | ||
task.go | ||
task_test.go | ||
types.go | ||
wait_all.go | ||
wait_all_test.go | ||
wait_any.go | ||
wait_any_test.go |
README.md
AsyncTask
Simple mimik of async/await for those come from C# world, so you don't need to dealing with waitGroup/channel in golang.
also the result is strongTyped with go generics, no type assertion is needed.
few chaining method provided:
- ContinueWith: send task1's output to task2 as input, return reference to task2.
- AfterBoth : send output of taskA, taskB to taskC as input, return reference to taskC.
- WaitAll: all of the task have to finish to end the wait (with an option to fail early if any task failed)
- WaitAny: any of the task finish would end the wait
// start task
task := asynctask.Start(ctx, countingTask)
// do something else
somethingelse()
// get the result
rawResult, err := task.Wait()
// or
task.Cancel()
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.