Open adg opened 11 years ago
Currently if you use a send statement in a switch you get this: $ cat z.go package main func main() { var c chan int switch { case c <- 0: } } $ go tool 6g z.go z.go:6: send statement c <- 0 used as value; use select for non-blocking send But it doesn't mean what you would expect and has nothing to do with switches. Actually the message is inherited from a pre r56 version (http://golang.org/doc/devel/weekly.html#2011-02-01) and it's rather confusing. I suggest that if someone fixes this issue the special message is removed.
I've mailed https://go-review.googlesource.com/37392.
CL https://golang.org/cl/37392 mentions this issue.
As mentioned by @griesemer in CL 37392, the compiler giving such suggestions is a slippery slope, so for now let's keep the issue and the CL open in case new ideas come up.