Skip to content

Commit e5d2bc9

Browse files
dependabot[bot]ldez
andauthoredFeb 15, 2024
build(deps): bump github.com/catenacyber/perfsprint from 0.6.0 to 0.7.0 (#4386)
Co-authored-by: Fernandez Ludovic <[email protected]>
·
v2.1.6v1.57.0
1 parent d7a461a commit e5d2bc9

File tree

7 files changed

+12
-6
lines changed

7 files changed

+12
-6
lines changed
 

‎.golangci.reference.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,9 +1435,12 @@ linters-settings:
14351435
# Optimizes `fmt.Errorf`.
14361436
# Default: true
14371437
errorf: false
1438-
# Optimizes `fmt.Sprintf` with only one argument
1438+
# Optimizes `fmt.Sprintf` with only one argument.
14391439
# Default: true
14401440
sprintf1: false
1441+
# Optimizes into strings concatenation.
1442+
# Default: true
1443+
strconcat: false
14411444

14421445
prealloc:
14431446
# IMPORTANT: we don't recommend using this linter before doing performance profiling.

‎go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/breml/errchkjson v0.3.6
2828
github.com/butuzov/ireturn v0.3.0
2929
github.com/butuzov/mirror v1.1.0
30-
github.com/catenacyber/perfsprint v0.6.0
30+
github.com/catenacyber/perfsprint v0.7.0
3131
github.com/charithe/durationcheck v0.0.10
3232
github.com/curioswitch/go-reassign v0.2.0
3333
github.com/daixiang0/gci v0.12.1

‎go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/config/linters_settings.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ var defaultLintersSettings = LintersSettings{
112112
ErrError: false,
113113
ErrorF: true,
114114
SprintF1: true,
115+
StrConcat: true,
115116
},
116117
Prealloc: PreallocSettings{
117118
Simple: true,
@@ -711,6 +712,7 @@ type PerfSprintSettings struct {
711712
ErrError bool `mapstructure:"err-error"`
712713
ErrorF bool `mapstructure:"errorf"`
713714
SprintF1 bool `mapstructure:"sprintf1"`
715+
StrConcat bool `mapstructure:"strconcat"`
714716
}
715717

716718
type PreallocSettings struct {

‎pkg/golinters/perfsprint.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func NewPerfSprint(settings *config.PerfSprintSettings) *goanalysis.Linter {
2020
cfg[a.Name]["err-error"] = settings.ErrError
2121
cfg[a.Name]["errorf"] = settings.ErrorF
2222
cfg[a.Name]["sprintf1"] = settings.SprintF1
23+
cfg[a.Name]["strconcat"] = settings.StrConcat
2324
}
2425

2526
return goanalysis.NewLinter(

‎test/testdata/perfsprint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestPerfsprint() {
2929
fmt.Sprint(ui) // want "fmt.Sprint can be replaced with faster strconv.FormatUint"
3030
fmt.Sprintf("%x", []byte{'a'}) // want "fmt.Sprintf can be replaced with faster hex.EncodeToString"
3131
fmt.Errorf("hello") // want "fmt.Errorf can be replaced with errors.New"
32-
fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string addition"
32+
fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string concatenation"
3333

3434
fmt.Sprint("test", 42)
3535
fmt.Sprint(42, 42)

‎test/testdata/perfsprint_custom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestPerfsprint2() {
3030
fmt.Sprint(ui)
3131
fmt.Sprintf("%x", []byte{'a'}) // want "fmt.Sprintf can be replaced with faster hex.EncodeToString"
3232
fmt.Errorf("hello")
33-
fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string addition"
33+
fmt.Sprintf("Hello %s", s) // want "fmt.Sprintf can be replaced with string concatenation"
3434

3535
fmt.Sprint("test", 42)
3636
fmt.Sprint(42, 42)

0 commit comments

Comments
 (0)
Please sign in to comment.