* 'Axel Wagner' via golang-nuts <golang-nuts@googlegroups.com> [200917 12:05]:
> I think you might've intended this, which does indeed print true:
>  type S []S
> var a, b S
> a, b = S{0: b}, S{0: a}
> fmt.Println(reflect.DeepEqual(a, b))

I was guessing he meant:

    type S []S
    var a, b S
    a = S{0: b}
    b = S{0: a}
    a[0] = b
    fmt.Println(reflect.DeepEqual(a, b))

which also returns true, but for a slightly different reason; check out
the following for each of the two cases:

    fmt.Printf("a[0] == nil: %t, b[0] == nil: %t\n", a[0] == nil, b[0] == nil)

...Marvin

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20200917175916.dl4mifoq5stwhk6t%40basil.wdw.

Reply via email to