4 ms·
don't do that? this kind of thing is why deepcompare exists to begin with
by ikiris 4y ago
don't do that?
this kind of thing is why deepcompare exists to begin with
- aetherane 4y agoIt seems unrealistic to assume that everyone on a reasonably sized team knows all of the subtle edge cases to avoid and never makes mistakes
- deleted 4y ago[deleted]
- erik_seaberg 4y agoI can nag everyone to use reflect.DeepEqual and live with some false negatives, but maps always use k1 == k2.
- Groxx 4y agoThere are also significant performance and behavior differences between the two. They are not inter-changeable, nor can one replace the other.
- ikiris 4y agomore specifically, it's really strange to hear of people doing equivalence checks on objects with structure. What are you expecting that comparison to do? I doubt it is doing what you think is happening, and is indeed risky of panics.
- mappu 4y agoThis is days later, sorry, but - you can't use an interface as a map key, so this shouldn't apply, right?
- erik_seaberg 4y agohttps://go.dev/ref/spec#Map_types https://go.dev/ref/spec#Map_types says that is allowed. > If the key type is an interface type, these comparison operators must be defined for the dynamic key values; failure will cause a run-time panic.