From f8c231c0ab20f4f19435a7082310108c4043c768 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 2 Feb 2024 22:41:22 +0100 Subject: [PATCH] chore: update implementation --- pkg/golinters/perfsprint.go | 17 ++++++++--------- test/testdata/perfsprint.go | 2 +- test/testdata/perfsprint_custom.go | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pkg/golinters/perfsprint.go b/pkg/golinters/perfsprint.go index a74fd9fa69a0..acaa3a522547 100644 --- a/pkg/golinters/perfsprint.go +++ b/pkg/golinters/perfsprint.go @@ -11,16 +11,15 @@ import ( func NewPerfSprint(settings *config.PerfSprintSettings) *goanalysis.Linter { a := analyzer.New() - var cfg map[string]map[string]any + cfg := map[string]map[string]any{ + a.Name: {"fiximports": false}, + } + if settings != nil { - cfg = map[string]map[string]any{ - a.Name: { - "int-conversion": settings.IntConversion, - "err-error": settings.ErrError, - "errorf": settings.ErrorF, - "sprintf1": settings.SprintF1, - }, - } + cfg[a.Name]["int-conversion"] = settings.IntConversion + cfg[a.Name]["err-error"] = settings.ErrError + cfg[a.Name]["errorf"] = settings.ErrorF + cfg[a.Name]["sprintf1"] = settings.SprintF1 } return goanalysis.NewLinter( diff --git a/test/testdata/perfsprint.go b/test/testdata/perfsprint.go index 5fca3b4a7f8a..8799f8f1da89 100644 --- a/test/testdata/perfsprint.go +++ b/test/testdata/perfsprint.go @@ -2,7 +2,7 @@ package testdata import ( - "fmt" // want "Fix imports" + "fmt" ) func TestPerfsprint() { diff --git a/test/testdata/perfsprint_custom.go b/test/testdata/perfsprint_custom.go index 07687e58e520..cf4e5ca9d15b 100644 --- a/test/testdata/perfsprint_custom.go +++ b/test/testdata/perfsprint_custom.go @@ -3,7 +3,7 @@ package testdata import ( - "fmt" // want "Fix imports" + "fmt" ) func TestPerfsprint2() {