Skip to content

Commit 29e5d8c

Browse files
ldezpolyfloyd
authored andcommitted
fix: remove init function
1 parent 7008f85 commit 29e5d8c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

errorlint/allowed.go

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ func allowedMapAppend(ap []AllowPair) {
9898
}
9999
}
100100

101-
func init() {
102-
allowedMapAppend(allowedErrors)
103-
}
104-
105101
var allowedErrorWildcards = []AllowPair{
106102
// pkg/syscall
107103
{err: "syscall.E", fun: "syscall."},

errorlint/allowed_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
)
66

77
func Test_isAllowedErrAndFunc(t *testing.T) {
8+
allowedMapAppend(allowedErrors)
9+
810
testCases := []struct {
911
desc string
1012
fun string
@@ -31,6 +33,7 @@ func Test_isAllowedErrAndFunc(t *testing.T) {
3133
},
3234
// {desc: "fail test", expect: true},
3335
}
36+
3437
for _, tt := range testCases {
3538
t.Run(tt.desc, func(t *testing.T) {
3639
result := isAllowedErrAndFunc(tt.err, tt.fun)

errorlint/analysis.go

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func NewAnalyzer(opts ...Option) *analysis.Analyzer {
1313
for _, o := range opts {
1414
o()
1515
}
16+
17+
allowedMapAppend(allowedErrors)
18+
1619
return &analysis.Analyzer{
1720
Name: "errorlint",
1821
Doc: "Source code linter for Go software that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.",

0 commit comments

Comments
 (0)