@@ -46,19 +46,23 @@ func NewGoconst() *goanalysis.Linter {
46
46
}
47
47
48
48
func checkConstants (pass * analysis.Pass , lintCtx * linter.Context ) ([]goanalysis.Issue , error ) {
49
+ settings := lintCtx .Settings ().Goconst
50
+
49
51
cfg := goconstAPI.Config {
50
- IgnoreTests : lintCtx . Settings (). Goconst .IgnoreTests ,
51
- MatchWithConstants : lintCtx . Settings (). Goconst .MatchWithConstants ,
52
- MinStringLength : lintCtx . Settings (). Goconst .MinStringLen ,
53
- MinOccurrences : lintCtx . Settings (). Goconst .MinOccurrencesCount ,
54
- ParseNumbers : lintCtx . Settings (). Goconst .ParseNumbers ,
55
- NumberMin : lintCtx . Settings (). Goconst .NumberMin ,
56
- NumberMax : lintCtx . Settings (). Goconst .NumberMax ,
52
+ IgnoreTests : settings .IgnoreTests ,
53
+ MatchWithConstants : settings .MatchWithConstants ,
54
+ MinStringLength : settings .MinStringLen ,
55
+ MinOccurrences : settings .MinOccurrencesCount ,
56
+ ParseNumbers : settings .ParseNumbers ,
57
+ NumberMin : settings .NumberMin ,
58
+ NumberMax : settings .NumberMax ,
57
59
ExcludeTypes : map [goconstAPI.Type ]bool {},
58
60
}
59
- if lintCtx .Settings ().Goconst .IgnoreCalls {
61
+
62
+ if settings .IgnoreCalls {
60
63
cfg .ExcludeTypes [goconstAPI .Call ] = true
61
64
}
65
+
62
66
goconstIssues , err := goconstAPI .Run (pass .Files , pass .Fset , & cfg )
63
67
if err != nil {
64
68
return nil , err
0 commit comments