Skip to content

Commit

Permalink
build(deps): bump github.com/catenacyber/perfsprint from 0.6.0 to 0.7…
Browse files Browse the repository at this point in the history
….0 (#4386)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and ldez committed Feb 15, 2024
1 parent d7a461a commit e5d2bc9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .golangci.reference.yml
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/config/linters_settings.go
Expand Up @@ -112,6 +112,7 @@ var defaultLintersSettings = LintersSettings{
ErrError: false,
ErrorF: true,
SprintF1: true,
StrConcat: true,
},
Prealloc: PreallocSettings{
Simple: true,
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/perfsprint.go
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/perfsprint.go
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/perfsprint_custom.go
Expand Up @@ -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)
Expand Down

0 comments on commit e5d2bc9

Please sign in to comment.