@@ -46,19 +46,23 @@ func NewGoconst() *goanalysis.Linter {
4646}
4747
4848func checkConstants (pass * analysis.Pass , lintCtx * linter.Context ) ([]goanalysis.Issue , error ) {
49+ settings := lintCtx .Settings ().Goconst
50+
4951 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 ,
5759 ExcludeTypes : map [goconstAPI.Type ]bool {},
5860 }
59- if lintCtx .Settings ().Goconst .IgnoreCalls {
61+
62+ if settings .IgnoreCalls {
6063 cfg .ExcludeTypes [goconstAPI .Call ] = true
6164 }
65+
6266 goconstIssues , err := goconstAPI .Run (pass .Files , pass .Fset , & cfg )
6367 if err != nil {
6468 return nil , err
0 commit comments