Re: [go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-27 Thread Julian Andres Klode
On Thu, Jul 27, 2017 at 09:36:31AM -0700, howardcs...@gmail.com wrote: > https://golang.org/pkg/reflect/#DeepEqual > > "Pointer values are deeply equal if they are equal using Go's == operator > or if they point to deeply equal values." > > By the rules described here, the fact that both pointer

Re: [go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Julian Andres Klode
On Wed, Jul 26, 2017 at 04:55:39PM +, Jan Mercl wrote: > On Wed, Jul 26, 2017 at 6:37 PM Julian Andres Klode > wrote: > > > Is there an existing alternative to reflect.DeepEqual() that also > respects the shape of the arguments? For example, the following tests fail: >

[go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Julian Andres Klode
Is there an existing alternative to reflect.DeepEqual() that also respects the shape of the arguments? For example, the following tests fail: type List struct { next *List } func TestList(t *testing.T) { a := &List{} a.next = a b := &List{a} if reflect.DeepEqual(a, b) { t.Error("Lists are equal"