Created
May 19, 2016 15:15
-
-
Save dgryski/2d2b428f4452f452bb95d390034e9ce5 to your computer and use it in GitHub Desktop.
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
<dgryski@kamek[w] \ʕ◔ϖ◔ʔ/ > cat main.go | |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
x := []int{1, 2, 3} | |
for i := range x { | |
go func() { | |
fmt.Println(i) | |
}() | |
} | |
time.Sleep(2) | |
} | |
<dgryski@kamek[w] \ʕ◔ϖ◔ʔ/ > go vet main.go | |
main.go:14: range variable i captured by func literal | |
exit status 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment