Skip to content

Commit 7950017

Browse files
author
Denis Krivak
committed
Change order of returned values.
1 parent eae25e3 commit 7950017

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

godot.go

+10-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Run(file *ast.File, fset *token.FileSet, settings Settings) []Issue {
4444
// Check all top-level comments
4545
if settings.CheckAll {
4646
for _, group := range file.Comments {
47-
if ok, iss := check(fset, group); !ok {
47+
if iss, ok := check(fset, group); !ok {
4848
issues = append(issues, iss)
4949
}
5050
}
@@ -55,26 +55,26 @@ func Run(file *ast.File, fset *token.FileSet, settings Settings) []Issue {
5555
for _, decl := range file.Decls {
5656
switch d := decl.(type) {
5757
case *ast.GenDecl:
58-
if ok, iss := check(fset, d.Doc); !ok {
58+
if iss, ok := check(fset, d.Doc); !ok {
5959
issues = append(issues, iss)
6060
}
6161
case *ast.FuncDecl:
62-
if ok, iss := check(fset, d.Doc); !ok {
62+
if iss, ok := check(fset, d.Doc); !ok {
6363
issues = append(issues, iss)
6464
}
6565
}
6666
}
6767
return issues
6868
}
6969

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) {
7171
if group == nil || len(group.List) == 0 {
72-
return true, Issue{}
72+
return Issue{}, true
7373
}
7474

7575
// Check only top-level comments
7676
if fset.Position(group.Pos()).Column > 1 {
77-
return true, Issue{}
77+
return Issue{}, true
7878
}
7979

8080
// 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) {
8484

8585
line, ok := checkComment(last.Text)
8686
if ok {
87-
return true, Issue{}
87+
return Issue{}, true
8888
}
8989
pos := fset.Position(last.Slash)
9090
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
9594
}
9695

9796
func checkComment(comment string) (line int, ok bool) {

0 commit comments

Comments
 (0)