Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Golang WaitGroups template
package main
func goroutineWithWaitGroup() {
wg := sync.WaitGroup{}
wg.Add(1)
go func(wg *sync.WaitGroup) {
defer wg.Done()
// ...
}(&wg)
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment