Skip to content

Instantly share code, notes, and snippets.

@aligoren
Created June 5, 2022 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aligoren/e2cc8ade9dc6ede314197fa329245d59 to your computer and use it in GitHub Desktop.
Save aligoren/e2cc8ade9dc6ede314197fa329245d59 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"sync"
)
func main() {
i := 0
wg := sync.WaitGroup{}
wg.Add((1))
go func() {
i++
wg.Done()
}()
wg.Wait()
i++
fmt.Printf("Number: %d", i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment