ids[f.Name] = &f.Examples
}
for _, m := range t.Methods {
- if !token.IsExported(m.Name) || m.Level != 0 { // avoid forwarded methods from embedding
+ if !token.IsExported(m.Name) {
continue
}
ids[strings.TrimPrefix(m.Recv, "*")+"_"+m.Name] = &m.Examples
type2 int
Embed struct { Type1 }
+ Uembed struct { type2 }
)
func Func1() {}
func (Type1) Func1_foo() {}
func (Type1) func2() {}
+func (type2) Func1() {}
+
type (
Conflict int
Conflict_Conflict int
func ExampleType1_Func1_foo_Suffix() {} // matches Type1.Func1, instead of Type1.Func1_foo
func ExampleType1_func2() {} // matches Type1, instead of Type1.func2
-func ExampleEmbed_Func1() {} // invalid - no support for forwarded methods from embedding
+func ExampleEmbed_Func1() {} // invalid - no support for forwarded methods from embedding exported type
+func ExampleUembed_Func1() {} // methods from embedding unexported types are OK
+func ExampleUembed_Func1_suffix() {}
func ExampleConflict_Conflict() {} // ambiguous with either Conflict or Conflict_Conflict type
func ExampleConflict_conflict() {} // ambiguous with either Conflict or Conflict_conflict type
"Type1.Func1_Foo": {"", "suffix"},
"Type1.Func1_foo": {"", "suffix"},
+ "Uembed.Func1": {"", "suffix"},
+
// These are implementation dependent due to the ambiguous parsing.
"Conflict_Conflict": {"", "suffix"},
"Conflict_conflict": {"", "suffix"},