2 ms·
For those who didn't dive into the spec, the non-blocking recieve syntax has changed to use the select statement: func f(ch chan int) { select { case v
by crawshaw 14y ago
For those who didn't dive into the spec, the non-blocking recieve syntax has changed to use the select statement:
func f(ch chan int) {
select {
case v := <-ch:
fmt.Println("got", v)
default:
fmt.Println("did not block")
}
}
http://play.golang.org/p/ql0qSUVXeX http://play.golang.org/p/ql0qSUVXeX