What version of Go are you using (go version)?
$ go version
go version go1.12 linux/amd64
Does this issue reproduce with the latest release?
Yes
What did you do?
type foo struct{}
func main() {
bar := foo{}
if bar == foo{} {
fmt.Println("true")
return
}
fmt.Println("false")
}
Play link
What did you expect to see?
What did you see instead?
prog.go:11:18: syntax error: unexpected { at end of statement
prog.go:15:2: syntax error: non-declaration statement outside function body
Please note that adding parentheses works
Is this intended? If so, shouldn't the compiler give better errors?
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What did you do?
Play link
What did you expect to see?
What did you see instead?
Please note that adding parentheses works
Is this intended? If so, shouldn't the compiler give better errors?