Closed josharian closed 2 years ago
For prior art, cmp.Diff
prints something like the following:
(*main.T)(
- &⟪0xc0000c8140⟫0,
+ &⟪0xc0000c8148⟫0,
)
It notices that both values would print as the same thing, and so it falls back to a more verbose printout that includes addresses to hopefully surface that these are different.
Tagged as v1.14.3
.
https://go.dev/play/p/vYkG-W6-tI2
Result:
That provided a needed bit of levity in my day, but it took me a while to figure out that the problem was that the two pointers were distinct. (This was made worse in my case by a
String
function that printed the complete internal state of the struct, removing the telltail&
at the beginning.)I'd suggest printing something like
%p %s
for got/want when they are both pointers. That'd make it much more obvious.