kylelemons/godebug

Comparing two pointers should not nest

vincentbernat opened this issue · 1 comments

Hey!

When comparing two pointers, it seems that pretty.Compare() doesn't satisfy itself by the pointer values being the same. It tries to compare the content of those two pointers. Usually, this works, but sometimes, one pointer can change during iteration. I understand this may be difficult to fix as currently, both values are turned into strings, then compared as strings.

Yep, the stringification is the whole basis for the library.
Pretty.Compare compares the pretty-printed values. It doesn't even enforce
that the two values are of the same types. As for the other point, it
can't prevent the objects from changing out from under it, you need to do
that as the caller.

On Wed, Aug 3, 2016, 5:41 AM Vincent Bernat notifications@github.com
wrote:

Hey!

When comparing two pointers, it seems that pretty.Compare() doesn't
satisfy itself by the pointer values being the same. It tries to compare
the content of those two pointers. Usually, this works, but sometimes, one
pointer can change during iteration. I understand this may be difficult to
fix as currently, both values are turned into strings, then compared as
strings.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#7, or mute the thread
https://github.com/notifications/unsubscribe-auth/AATqpV3cEZrjWMZmQ9Kxwlk2NxA3cIHHks5qcIfhgaJpZM4Jbmn1
.