interfacebloat: fix configuration loading (#3194)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Anton Kachurin 2022-09-05 13:27:46 +03:00 committed by GitHub
parent 70d595e91d
commit 091d2f4324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -62,6 +62,9 @@ var defaultLintersSettings = LintersSettings{
MaxDeclLines: 1,
MaxDeclChars: 30,
},
InterfaceBloat: InterfaceBloatSettings{
Max: 10,
},
Lll: LllSettings{
LineLength: 120,
TabWidth: 1,

View File

@ -11,10 +11,12 @@ import (
func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Linter {
a := analyzer.New()
cfgMap := make(map[string]map[string]interface{})
var cfg map[string]map[string]interface{}
if settings != nil {
cfgMap[a.Name] = map[string]interface{}{
cfg = map[string]map[string]interface{}{
a.Name: {
analyzer.InterfaceMaxMethodsFlag: settings.Max,
},
}
}
@ -22,6 +24,6 @@ func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Lint
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
cfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
}