Skip to content

Instantly share code, notes, and snippets.

@brydavis
Last active March 20, 2016 16:28
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 brydavis/7bcd4f5bb92460c68b66 to your computer and use it in GitHub Desktop.
Save brydavis/7bcd4f5bb92460c68b66 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
s := make(chan int)
X(s)
fmt.Println(<-s)
}
func X(s chan int) {
for i := 0; i < 10; i++ {
go func(x int) {
s <- x
}(i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment