`Comment about exported interface`,
},
},
+ // Interface method at package level.
+ {
+ "interface method at package level",
+ []string{p, `ExportedMethod`},
+ []string{
+ `func \(ExportedType\) ExportedMethod\(a int\) bool`,
+ `Comment about exported method`,
+ },
+ []string{
+ `Comment before exported method.*\n.*ExportedMethod\(\)` +
+ `.*Comment on line with exported method`,
+ },
+ },
// Method.
{
}
// printMethodDoc prints the docs for matches of symbol.method.
-// If symbol is empty, it prints all methods that match the name.
-// It reports whether it found any methods.
+// If symbol is empty, it prints all methods for any concrete type
+// that match the name. It reports whether it found any methods.
func (pkg *Package) printMethodDoc(symbol, method string) bool {
defer pkg.flush()
types := pkg.findTypes(symbol)
}
continue
}
+ if symbol == "" {
+ continue
+ }
// Type may be an interface. The go/doc package does not attach
// an interface's methods to the doc.Type. We need to dig around.
spec := pkg.findTypeSpec(typ.Decl, typ.Name)