Skip to content

Instantly share code, notes, and snippets.

@0xc0d
Created October 25, 2020 03:36
Show Gist options
  • Save 0xc0d/ead0a0437a2a0f1b02456d2a30f039a4 to your computer and use it in GitHub Desktop.
Save 0xc0d/ead0a0437a2a0f1b02456d2a30f039a4 to your computer and use it in GitHub Desktop.
Call WaitGroup.Wait in loop
var wg sync.WaitGroup
wg.Add(len(tasks))
for _, t := range tasks {
go func(t *task) {
defer group.Done()
}(t)
// group.Wait()
}
group.Wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment