How to use wait group?
var wg sync.WaitGroup
wg.Add(16)
for i := 0; i < 16; i++ {
go func(i int) {
// do process
wg.Done()
}(i)
}
wg.Wait()
Cheatsheet collection for go, rust, python, shell and javascript.
How to use wait group?
var wg sync.WaitGroup
wg.Add(16)
for i := 0; i < 16; i++ {
go func(i int) {
// do process
wg.Done()
}(i)
}
wg.Wait()