Skip to content

Commit 7008f85

Browse files
ldezpolyfloyd
authored andcommitted
chore: fix var initializations
1 parent 15b984b commit 7008f85

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

errorlint/analysis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func init() {
3737
}
3838

3939
func run(pass *analysis.Pass) (interface{}, error) {
40-
lints := []analysis.Diagnostic{}
40+
var lints []analysis.Diagnostic
4141
extInfo := newTypesInfoExt(pass)
4242
if checkComparison {
4343
l := LintErrorComparisons(extInfo)

errorlint/lint.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ func (l ByPosition) Less(i, j int) bool {
2020
}
2121

2222
func LintFmtErrorfCalls(fset *token.FileSet, info types.Info, multipleWraps bool) []analysis.Diagnostic {
23-
lints := []analysis.Diagnostic{}
23+
var lints []analysis.Diagnostic
24+
2425
for expr, t := range info.Types {
2526
// Search for error expressions that are the result of fmt.Errorf
2627
// invocations.
@@ -159,7 +160,7 @@ func isFmtErrorfCallExpr(info types.Info, expr ast.Expr) (*ast.CallExpr, bool) {
159160
}
160161

161162
func LintErrorComparisons(info *TypesInfoExt) []analysis.Diagnostic {
162-
lints := []analysis.Diagnostic{}
163+
var lints []analysis.Diagnostic
163164

164165
for expr := range info.TypesInfo.Types {
165166
// Find == and != operations.
@@ -289,7 +290,7 @@ func switchComparesNonNil(switchStmt *ast.SwitchStmt) bool {
289290
}
290291

291292
func LintErrorTypeAssertions(fset *token.FileSet, info *TypesInfoExt) []analysis.Diagnostic {
292-
lints := []analysis.Diagnostic{}
293+
var lints []analysis.Diagnostic
293294

294295
for expr := range info.TypesInfo.Types {
295296
// Find type assertions.

0 commit comments

Comments
 (0)