https://github.com/code-hex/go-async
More Easy, more readable sync.WaitGroup
https://github.com/code-hex/go-async
Last synced: 2 months ago
JSON representation
More Easy, more readable sync.WaitGroup
- Host: GitHub
- URL: https://github.com/code-hex/go-async
- Owner: Code-Hex
- License: mit
- Created: 2019-02-01T04:20:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-01T04:58:21.000Z (almost 7 years ago)
- Last Synced: 2025-05-12T19:33:37.569Z (7 months ago)
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Go Async-Group
=====
Go Async Group can be more easily manage goroutine.
[](https://circleci.com/gh/Code-Hex/go-async)
[](https://codecov.io/gh/Code-Hex/go-async)
[](https://goreportcard.com/report/github.com/Code-Hex/go-async)
[](https://godoc.org/github.com/Code-Hex/go-async)
[errgroup](https://godoc.org/golang.org/x/sync/errgroup) has the goal is to cancel all asynchronous when at least one async fails.
This package is used to wait until all the executed asynchronous processing is finished.
# Synopsis
```go
func main() {
var ag async.Group
var sum, expected uint32
for i := 0; i < times; i++ {
expected++
ag.Go(func() {
atomic.AddUint32(&sum, 1)
})
}
ag.Wait()
fmt.Println(sum, expected)
}
```
If you want to use at your application, see [example](https://github.com/Code-Hex/go-async/blob/master/example_test.go).
# Installation
go get -u github.com/Code-Hex/go-async
# Contribution
1. Fork [https://github.com/Code-Hex/go-async/fork](https://github.com/Code-Hex/go-async/fork)
2. Commit your changes
3. Create a new Pull Request
I'm waiting for a lot of PR.
# Author
[codehex](https://twitter.com/CodeHex)