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
type I interface {
V() string
}
type foo struct{
v string
}
func(f foo) V() string {
return f.v
}
type bar struct{
v string
}
func(b bar) V() string {
return b.v
}
var a,b I
a = foo{"test"}
b = bar{"test"}
cmp.Equal(a,b, cmp.Comparer(func(a, b I) {
return a.V() == b.V()
})
Expectation: the comparer will be used to determine equality.
Reality: because a and b are different types they get wrapped in an empty interface which then fails the "can it be assigned to this interface" test and the comparer never gets invoked.
The text was updated successfully, but these errors were encountered:
Consider the following example:
Expectation: the comparer will be used to determine equality.
Reality: because a and b are different types they get wrapped in an empty interface which then fails the "can it be assigned to this interface" test and the comparer never gets invoked.
The text was updated successfully, but these errors were encountered: