Debian Codegraph @

stylecheck/st1020/testdata/go1.0/CheckExportedFunctionDocs/CheckExportedFunctionDocs.go

raw
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 // Deprecated: don't use.
24 func (T) Dep() {}
25
26 //
27 func Qux() {} // this is fine, because "no comment" and "empty comment" are treated the same
28
29 //
30 // Meow is amazing.
31 //
32 // godoc allows this style, because ast.CommentGroup.Text strips whitespace.
33 // We currently make no effort to flag it.
34 //
35 func Meow() {}
36
37 //some:directive
38 func F1() {} // we pretend that directives aren't part of the doc string, just like godoc in Go 1.15+ does
39
40 //some:directive
41 // F2 is amazing
42 func F2() {}
43
44 //some:directive //@ diag(`comment on exported function`)
45 // Whatever
46 func F3() {}
47
48 // Deprecated: don't use.
49 func F4() {}
50
51 //some:directive
52 // Deprecated: don't use.
53 func F5() {}
54
55 // wrong comment yo. //@diag (`comment on exported function`)
56 //
57 // Deprecated: don't use.
58 func F6() {}