Skip to content

Commit 091d2f4

Browse files
outcatcherldez
andauthored
interfacebloat: fix configuration loading (#3194)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 70d595e commit 091d2f4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pkg/config/linters_settings.go

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ var defaultLintersSettings = LintersSettings{
6262
MaxDeclLines: 1,
6363
MaxDeclChars: 30,
6464
},
65+
InterfaceBloat: InterfaceBloatSettings{
66+
Max: 10,
67+
},
6568
Lll: LllSettings{
6669
LineLength: 120,
6770
TabWidth: 1,

pkg/golinters/interfacebloat.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ import (
1111
func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Linter {
1212
a := analyzer.New()
1313

14-
cfgMap := make(map[string]map[string]interface{})
14+
var cfg map[string]map[string]interface{}
1515
if settings != nil {
16-
cfgMap[a.Name] = map[string]interface{}{
17-
analyzer.InterfaceMaxMethodsFlag: settings.Max,
16+
cfg = map[string]map[string]interface{}{
17+
a.Name: {
18+
analyzer.InterfaceMaxMethodsFlag: settings.Max,
19+
},
1820
}
1921
}
2022

2123
return goanalysis.NewLinter(
2224
a.Name,
2325
a.Doc,
2426
[]*analysis.Analyzer{a},
25-
nil,
27+
cfg,
2628
).WithLoadMode(goanalysis.LoadModeSyntax)
2729
}

0 commit comments

Comments
 (0)