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

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

2017-07-27 Thread howardcshaw
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 pointers have the same value means it does not even NEED to check what they point to, so

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: > >

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

2017-07-26 Thread Jan Mercl
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: a and b _are_ of equal shape and contain equal values:

[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 := {} a.next = a b := {a} if reflect.DeepEqual(a, b) { t.Error("Lists are equal") } }