Skip to content

Instantly share code, notes, and snippets.

@0xc0d
Created October 25, 2020 03:28
Show Gist options
  • Save 0xc0d/8e7d3adf5aab0600040c3198cc371442 to your computer and use it in GitHub Desktop.
Save 0xc0d/8e7d3adf5aab0600040c3198cc371442 to your computer and use it in GitHub Desktop.
Using goroutines on loop iterator variables
list := []int{1, 2, 3}
for _, v := range list {
go func() {
fmt.Printf("%d ", v)
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment