honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/stylecheck/st1020/testdata/src/example.com/CheckExportedFunctionDocs/CheckExportedFunctionDocs.go (about) 1 package pkg 2 3 // whatever 4 func foo() {} 5 6 // Foo is amazing 7 func Foo() {} 8 9 // Whatever //@ diag(`comment on exported function`) 10 func Bar() {} 11 12 type T struct{} 13 14 // Whatever 15 func (T) foo() {} 16 17 // Foo is amazing 18 func (T) Foo() {} 19 20 // Whatever //@ diag(`comment on exported method`) 21 func (T) Bar() {} 22 23 // 24 func Qux() {} // this is fine, because "no comment" and "empty comment" are treated the same 25 26 // 27 // Meow is amazing. 28 // 29 // godoc allows this style, because ast.CommentGroup.Text strips whitespace. 30 // We currently make no effort to flag it. 31 // 32 func Meow() {} 33 34 //some:directive 35 func F1() {} // we pretend that directives aren't part of the doc string, just like godoc in Go 1.15+ does 36 37 //some:directive 38 // F2 is amazing 39 func F2() {} 40 41 //some:directive //@ diag(`comment on exported function`) 42 // Whatever 43 func F3() {}