Skip to content

Commit

Permalink
fixed some complex code (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
sina-devel authored Sep 26, 2021
1 parent 527bea8 commit 0bcc996
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lint/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ func (f *File) IsUntypedConst(expr ast.Expr) (defType string, ok bool) {
}

func (f *File) isMain() bool {
if f.AST.Name.Name == "main" {
return true
}
return false
return f.AST.Name.Name == "main"
}

const directiveSpecifyDisableReason = "specify-disable-reason"
Expand Down
2 changes: 1 addition & 1 deletion rule/add-constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r *AddConstantRule) Apply(file *lint.File, arguments lint.Arguments) []lin
failures = append(failures, failure)
}

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

ast.Walk(w, file.AST)

Expand Down
2 changes: 1 addition & 1 deletion rule/empty-block.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (r *EmptyBlockRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure
failures = append(failures, failure)
}

w := lintEmptyBlock{make(map[*ast.BlockStmt]bool, 0), onFailure}
w := lintEmptyBlock{make(map[*ast.BlockStmt]bool), onFailure}
ast.Walk(w, file.AST)
return failures
}
Expand Down
1 change: 0 additions & 1 deletion rule/max-public-structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func (w *lintMaxPublicStructs) Visit(n ast.Node) ast.Visitor {
if strings.ToUpper(first) == first {
w.current++
}
break
}
return w
}

0 comments on commit 0bcc996

Please sign in to comment.