From 091d2f4324405ebbf713580ba048bb5699c1ee18 Mon Sep 17 00:00:00 2001 From: Anton Kachurin <katchuring@gmail.com> Date: Mon, 5 Sep 2022 13:27:46 +0300 Subject: [PATCH] interfacebloat: fix configuration loading (#3194) Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com> --- pkg/config/linters_settings.go | 3 +++ pkg/golinters/interfacebloat.go | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index ec368e7d..97f38e7b 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -62,6 +62,9 @@ var defaultLintersSettings = LintersSettings{ MaxDeclLines: 1, MaxDeclChars: 30, }, + InterfaceBloat: InterfaceBloatSettings{ + Max: 10, + }, Lll: LllSettings{ LineLength: 120, TabWidth: 1, diff --git a/pkg/golinters/interfacebloat.go b/pkg/golinters/interfacebloat.go index f9cf81c8..044c96f3 100644 --- a/pkg/golinters/interfacebloat.go +++ b/pkg/golinters/interfacebloat.go @@ -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{}{ - analyzer.InterfaceMaxMethodsFlag: settings.Max, + 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) }