equal func in type?

76 views
Skip to first unread message

xie cui

unread,
Dec 16, 2020, 1:32:38 AM12/16/20
to golang-nuts
https://github.com/golang/go/blob/master/src/reflect/type.go#L315
is  this equal func generate by compiler, so where can i find the code generate this func?
what is the rule for compare two object of same struct?

Axel Wagner

unread,
Dec 16, 2020, 8:29:00 AM12/16/20
to xie cui, golang-nuts
On Wed, Dec 16, 2020 at 7:34 AM xie cui <cuiw...@gmail.com> wrote:
https://github.com/golang/go/blob/master/src/reflect/type.go#L315
is  this equal func generate by compiler,

Yes, or by `reflect`.
 
so where can i find the code generate this func?

 
what is the rule for compare two object of same struct?


> Struct values are comparable if all their fields are comparable. Two struct values are equal if their corresponding non-blank fields are equal.

 

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d43edfbf-87c0-4cd2-bf02-0e4c8251edabn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages