You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
ALTree
changed the title
go: error message when comparing structs containing slices less helpful in go1.18
cmd/compile: error message when comparing structs containing slices less helpful in go1.18
Jan 31, 2022
griesemer
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Feb 1, 2022
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:Using
go1.18-a5c0b19080
, however, the error message is less helpful: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: