Re: [go-nuts] does struct pointer *a == *b make sense?

2018-11-28 Thread Youqi yu
thank you very much. I understand!! :) 在 2018年11月23日星期五 UTC+8上午11:13:55,Uzondu Enudeme写道: > > Yes. They are equal. > > According to the go language spec: > > >- Struct values are comparable if all their fields are comparable. Two >struct values are equal if their corresponding non-blank

Re: [go-nuts] does struct pointer *a == *b make sense?

2018-11-23 Thread Space A.
true: a := {Name:"test", Child: {Name: "blah", Child: nil}} b :={Name:"test", Child: a.Child} and it's not "childs" пятница, 23 ноября 2018 г., 6:20:31 UTC+3 пользователь Jesse McNelis написал: > > On Fri, Nov 23, 2018 at 2:06 PM Youqi yu > wrote: > > > > type T { > > Name string > >

Re: [go-nuts] does struct pointer *a == *b make sense?

2018-11-22 Thread Jesse McNelis
On Fri, Nov 23, 2018 at 2:06 PM Youqi yu wrote: > > type T { > Name string > } > a := {Name:"test"} > b :={Name:"test"} > *a == *b > Hi, all, I am beginner at golang, I have a question that when compare struct > equality, I was told to use reflect.DeepEqual or make my own function. but > the

Re: [go-nuts] does struct pointer *a == *b make sense?

2018-11-22 Thread Uzondu Enudeme
Yes. They are equal. According to the go language spec: - Struct values are comparable if all their fields are comparable. Two struct values are equal if their corresponding non-blank fields are equal. You can go through that part of the

[go-nuts] does struct pointer *a == *b make sense?

2018-11-22 Thread Youqi yu
type T { Name string } a := {Name:"test"} b :={Name:"test"} *a == *b Hi, all, I am beginner at golang, I have a question that when compare struct equality, I was told to use reflect.DeepEqual or make my own function. but the result of above code is true. Does it mean struct a equals struct b?