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

On Thu, Sep 17, 2020 at 6:03 PM Axel Wagner <axel.wagner...@googlemail.com>
wrote:

> I don't think the docs imply that. For one, a[0] is nil, and b[0] isn't.
>
> On Thu, Sep 17, 2020 at 5:58 PM tapi...@gmail.com <tapir....@gmail.com>
> wrote:
>
>>
>> package main
>>
>> import (
>>   "fmt"
>>   "reflect"
>> )
>>
>> func main() {
>>   f()
>> }
>>
>> func f() {
>>   type S []S
>>   var a, b S
>>   a = S{0: b}
>>   b = S{0: a}
>>   fmt.Println(reflect.DeepEqual(a, b))
>> }
>>
>> Now it prints false. But it looks the docs indicates it should print true.
>>
>> --
>> 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/dbe73874-ec0f-413d-bed6-47f213bede91n%40googlegroups.com
>> <https://groups.google.com/d/msgid/golang-nuts/dbe73874-ec0f-413d-bed6-47f213bede91n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CAEkBMfGbqgMJEu09xRmRjFiQv7hbLP7jh5kzcJMGJGQJT6396w%40mail.gmail.com.

Reply via email to