Skip to content

Instantly share code, notes, and snippets.

@cjavilla-stripe
Last active July 23, 2020 18:22
Show Gist options
  • Save cjavilla-stripe/4b5e26cc5a8a53f39bb3568acd1d101c to your computer and use it in GitHub Desktop.
Save cjavilla-stripe/4b5e26cc5a8a53f39bb3568acd1d101c to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func a(x chan int) {
fmt.Println("a")
x <- 9
}
func b(y chan int) {
fmt.Println("b")
y <- 10
}
func main() {
c := make(chan int)
go a(c)
go b(c)
x, y := <-c, <-c
fmt.Println(x, y)
fmt.Println("done")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment