New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: error message for bad case in switch should suggest select #4697
Comments
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. |
rsc
changed the title
cmd/gc: error message for bad case in switch should suggest select
cmd/compile: error message for bad case in switch should suggest select
Jun 8, 2015
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: