Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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