This code doesn't do what you think it does:
func f(x, y reflect.Value) bool {
return reflect.DeepEqual(x, y)
}
It compares the internal details of the two reflect.Value structs, not their contents. The correct code would be reflect.DeepEqual(x.Interface(), y.Interface()).
I don't see any reason why you'd ever want to use DeepEqual on a reflect.Value. Hence no false positives.
If you really wanted to compare two reflect.Values (but you shouldn't), == is equivalent to DeepEqual.
Seems like an easy mistake to make (see #43986 ). Not sure how common it might be, but I suspect it might be common enough to warrant a check.
This code doesn't do what you think it does:
It compares the internal details of the two
reflect.Valuestructs, not their contents. The correct code would bereflect.DeepEqual(x.Interface(), y.Interface()).I don't see any reason why you'd ever want to use
DeepEqualon areflect.Value. Hence no false positives.If you really wanted to compare two
reflect.Values (but you shouldn't),==is equivalent toDeepEqual.Seems like an easy mistake to make (see #43986 ). Not sure how common it might be, but I suspect it might be common enough to warrant a check.