On Thu, Aug 18, 2016 at 10:16 PM, T L <tapir....@gmail.com> wrote: > > package main > > type S1 struct { } > > func (*S1) f() {} > > type S2 struct { S1 } > > // var _ = S1.f // S1.f undefined (type S1 has no method f) > // var _ = S2.f // S2.f undefined (type S2 has no method f) > var _ = (*S2).f // ok!
Not weird. See the rules about method sets when embedding types. https://golang.org/ref/spec#Method_sets https://golang.org/ref/spec#Struct_types Ian -- 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. For more options, visit https://groups.google.com/d/optout.