build(deps): bump github.com/catenacyber/perfsprint from 0.6.0 to 0.7.0 (#4386)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2024-02-15 20:01:52 +01:00 committed by GitHub
parent d7a461a045
commit e5d2bc9529
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 12 additions and 6 deletions

View File

@ -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.

2
go.mod
View File

@ -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

4
go.sum generated
View File

@ -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=

View File

@ -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 {

View File

@ -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(

View File

@ -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)

View File

@ -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)