Skip to content

Commit 0bcc996

Browse files
authored
fixed some complex code (#580)
1 parent 527bea8 commit 0bcc996

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

lint/file.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ func (f *File) IsUntypedConst(expr ast.Expr) (defType string, ok bool) {
9191
}
9292

9393
func (f *File) isMain() bool {
94-
if f.AST.Name.Name == "main" {
95-
return true
96-
}
97-
return false
94+
return f.AST.Name.Name == "main"
9895
}
9996

10097
const directiveSpecifyDisableReason = "specify-disable-reason"

rule/add-constant.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (r *AddConstantRule) Apply(file *lint.File, arguments lint.Arguments) []lin
8282
failures = append(failures, failure)
8383
}
8484

85-
w := lintAddConstantRule{onFailure: onFailure, strLits: make(map[string]int, 0), strLitLimit: strLitLimit, whiteLst: whiteList}
85+
w := lintAddConstantRule{onFailure: onFailure, strLits: make(map[string]int), strLitLimit: strLitLimit, whiteLst: whiteList}
8686

8787
ast.Walk(w, file.AST)
8888

rule/empty-block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func (r *EmptyBlockRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure
1717
failures = append(failures, failure)
1818
}
1919

20-
w := lintEmptyBlock{make(map[*ast.BlockStmt]bool, 0), onFailure}
20+
w := lintEmptyBlock{make(map[*ast.BlockStmt]bool), onFailure}
2121
ast.Walk(w, file.AST)
2222
return failures
2323
}

rule/max-public-structs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func (w *lintMaxPublicStructs) Visit(n ast.Node) ast.Visitor {
6363
if strings.ToUpper(first) == first {
6464
w.current++
6565
}
66-
break
6766
}
6867
return w
6968
}

0 commit comments

Comments
 (0)