What version of Go are you using (go version)?
go version devel +9044f018ec Tue Jan 9 01:53:38 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What did you do?
https://play.golang.org/p/v7w9KCIbiDx
What did you expect to see?
syntax error: 0 = 1 used as value
What did you see instead?
syntax error: true || 0 = 1 used as value
I encountered this in a real program, where I typed = instead of ==. The overall boolean expression was much larger, so the error message wasn't very useful. I had to read the whole thing to manually spot where the mistake was.
I think that this error should instead point at what subexpression was invalid. That is, assuming that the syntax tree resulting from the bad program above has enough information to do that, which I hope it does. /cc @griesemer
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes.
What did you do?
https://play.golang.org/p/v7w9KCIbiDx
What did you expect to see?
What did you see instead?
I encountered this in a real program, where I typed
=instead of==. The overall boolean expression was much larger, so the error message wasn't very useful. I had to read the whole thing to manually spot where the mistake was.I think that this error should instead point at what subexpression was invalid. That is, assuming that the syntax tree resulting from the bad program above has enough information to do that, which I hope it does. /cc @griesemer