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?
to your account
In Go, slices are not comparable using ==. The same is true for structs containing slices. (spec)
Using go1.17.6, this is reported with an error message that clearly states what is wrong:
./prog.go:13:7: invalid operation: a == b (struct containing string cannot be compared)
Using go1.18-a5c0b19080, however, the error message is less helpful:
./prog.go:13:5: invalid operation: cannot compare a == b (operator == not defined on thing)
This can be reproduced on the Go Playground, by switching between "Go release" and "Go dev branch": https://go.dev/play/p/kvCNFuMZzOF
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. The 1.17 error message is indeed quite better.
Sorry, something went wrong.
Change https://golang.org/cl/381964 mentions this issue: cmd/compile/internal/types2: better error messages for comparisons
cmd/compile/internal/types2: better error messages for comparisons
No branches or pull requests