Created
October 25, 2020 03:36
-
-
Save 0xc0d/ead0a0437a2a0f1b02456d2a30f039a4 to your computer and use it in GitHub Desktop.
Call WaitGroup.Wait in loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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