@@ -44,7 +44,7 @@ func Run(file *ast.File, fset *token.FileSet, settings Settings) []Issue {
44
44
// Check all top-level comments
45
45
if settings .CheckAll {
46
46
for _ , group := range file .Comments {
47
- if ok , iss := check (fset , group ); ! ok {
47
+ if iss , ok := check (fset , group ); ! ok {
48
48
issues = append (issues , iss )
49
49
}
50
50
}
@@ -55,26 +55,26 @@ func Run(file *ast.File, fset *token.FileSet, settings Settings) []Issue {
55
55
for _ , decl := range file .Decls {
56
56
switch d := decl .(type ) {
57
57
case * ast.GenDecl :
58
- if ok , iss := check (fset , d .Doc ); ! ok {
58
+ if iss , ok := check (fset , d .Doc ); ! ok {
59
59
issues = append (issues , iss )
60
60
}
61
61
case * ast.FuncDecl :
62
- if ok , iss := check (fset , d .Doc ); ! ok {
62
+ if iss , ok := check (fset , d .Doc ); ! ok {
63
63
issues = append (issues , iss )
64
64
}
65
65
}
66
66
}
67
67
return issues
68
68
}
69
69
70
- func check (fset * token.FileSet , group * ast.CommentGroup ) (ok bool , iss Issue ) {
70
+ func check (fset * token.FileSet , group * ast.CommentGroup ) (iss Issue , ok bool ) {
71
71
if group == nil || len (group .List ) == 0 {
72
- return true , Issue {}
72
+ return Issue {}, true
73
73
}
74
74
75
75
// Check only top-level comments
76
76
if fset .Position (group .Pos ()).Column > 1 {
77
- return true , Issue {}
77
+ return Issue {}, true
78
78
}
79
79
80
80
// Get last element from comment group - it can be either
@@ -84,14 +84,13 @@ func check(fset *token.FileSet, group *ast.CommentGroup) (ok bool, iss Issue) {
84
84
85
85
line , ok := checkComment (last .Text )
86
86
if ok {
87
- return true , Issue {}
87
+ return Issue {}, true
88
88
}
89
89
pos := fset .Position (last .Slash )
90
90
pos .Line += line
91
- return false , Issue {
92
- Pos : pos ,
93
- Message : noPeriodMessage ,
94
- }
91
+ iss .Pos = pos
92
+ iss .Message = noPeriodMessage
93
+ return iss , false
95
94
}
96
95
97
96
func checkComment (comment string ) (line int , ok bool ) {
0 commit comments