From e5d2bc95297710ff7cde84b6ea382fa88c770e46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:01:52 +0100 Subject: [PATCH] build(deps): bump github.com/catenacyber/perfsprint from 0.6.0 to 0.7.0 (#4386) Co-authored-by: Fernandez Ludovic --- .golangci.reference.yml | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- pkg/config/linters_settings.go | 2 ++ pkg/golinters/perfsprint.go | 1 + test/testdata/perfsprint.go | 2 +- test/testdata/perfsprint_custom.go | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index c59019aa..d032fbb8 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1435,9 +1435,12 @@ linters-settings: # Optimizes `fmt.Errorf`. # Default: true errorf: false - # Optimizes `fmt.Sprintf` with only one argument + # Optimizes `fmt.Sprintf` with only one argument. # Default: true sprintf1: false + # Optimizes into strings concatenation. + # Default: true + strconcat: false prealloc: # IMPORTANT: we don't recommend using this linter before doing performance profiling. diff --git a/go.mod b/go.mod index a487722c..6e48bde0 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/breml/errchkjson v0.3.6 github.com/butuzov/ireturn v0.3.0 github.com/butuzov/mirror v1.1.0 - github.com/catenacyber/perfsprint v0.6.0 + github.com/catenacyber/perfsprint v0.7.0 github.com/charithe/durationcheck v0.0.10 github.com/curioswitch/go-reassign v0.2.0 github.com/daixiang0/gci v0.12.1 diff --git a/go.sum b/go.sum index cb88d72c..bbc4a066 100644 --- a/go.sum +++ b/go.sum @@ -100,8 +100,8 @@ github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0 github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= -github.com/catenacyber/perfsprint v0.6.0 h1:VSv95RRkk5+BxrU/YTPcnxuMEWar1iMK5Vyh3fWcBfs= -github.com/catenacyber/perfsprint v0.6.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/catenacyber/perfsprint v0.7.0 h1:rKQKns5tJLHtB52z/1KZ4V2NlYnyJa7MAthhoM3I3Zk= +github.com/catenacyber/perfsprint v0.7.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index c860c2ed..c8cae445 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -112,6 +112,7 @@ var defaultLintersSettings = LintersSettings{ ErrError: false, ErrorF: true, SprintF1: true, + StrConcat: true, }, Prealloc: PreallocSettings{ Simple: true, @@ -711,6 +712,7 @@ type PerfSprintSettings struct { ErrError bool `mapstructure:"err-error"` ErrorF bool `mapstructure:"errorf"` SprintF1 bool `mapstructure:"sprintf1"` + StrConcat bool `mapstructure:"strconcat"` } type PreallocSettings struct { diff --git a/pkg/golinters/perfsprint.go b/pkg/golinters/perfsprint.go index acaa3a52..6fe315fd 100644 --- a/pkg/golinters/perfsprint.go +++ b/pkg/golinters/perfsprint.go @@ -20,6 +20,7 @@ func NewPerfSprint(settings *config.PerfSprintSettings) *goanalysis.Linter { cfg[a.Name]["err-error"] = settings.ErrError cfg[a.Name]["errorf"] = settings.ErrorF cfg[a.Name]["sprintf1"] = settings.SprintF1 + cfg[a.Name]["strconcat"] = settings.StrConcat } return goanalysis.NewLinter( diff --git a/test/testdata/perfsprint.go b/test/testdata/perfsprint.go index 8799f8f1..ca2ae1db 100644 --- a/test/testdata/perfsprint.go +++ b/test/testdata/perfsprint.go @@ -29,7 +29,7 @@ func TestPerfsprint() { fmt.Sprint(ui) // want "fmt.Sprint can be replaced with faster strconv.FormatUint" fmt.Sprintf("%x", []byte{'a'}) // want "fmt.Sprintf can be replaced with faster hex.EncodeToString" fmt.Errorf("hello") // want "fmt.Errorf can be replaced with errors.New" - fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string addition" + fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string concatenation" fmt.Sprint("test", 42) fmt.Sprint(42, 42) diff --git a/test/testdata/perfsprint_custom.go b/test/testdata/perfsprint_custom.go index cf4e5ca9..04de585b 100644 --- a/test/testdata/perfsprint_custom.go +++ b/test/testdata/perfsprint_custom.go @@ -30,7 +30,7 @@ func TestPerfsprint2() { fmt.Sprint(ui) fmt.Sprintf("%x", []byte{'a'}) // want "fmt.Sprintf can be replaced with faster hex.EncodeToString" fmt.Errorf("hello") - fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string addition" + fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string concatenation" fmt.Sprint("test", 42) fmt.Sprint(42, 42)