Skip to content

Commit

Permalink
fixup! linter: add perfsprint
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber committed Oct 19, 2023
1 parent ba81211 commit 71df6c3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/golinters/perfsprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)

func NewGoStrconv() *goanalysis.Linter {
func NewPerfSprint() *goanalysis.Linter {
return goanalysis.NewLinter(
"perfsprint",
"Checks usages of `fmt.Sprintf` which have faster alternatives.",
Expand Down
2 changes: 1 addition & 1 deletion pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {

linter.NewConfig(golinters.NewPerfSprint()).
WithSince("v1.54.2").
WithPresets(linter.PresetStyle).
WithPresets(linter.PresetPerformance).
WithURL("https://github.com/catenacyber/perfsprint"),

linter.NewConfig(golinters.NewPreAlloc(preallocCfg)).
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/perfsprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package testdata
import "fmt"

func SprintfCouldBeStrconv() {
fmt.Sprintf("%d", 42) // want "Sprintf can be replaced with faster strconv.Itoa"
fmt.Sprintf("%d", 42) // want "fmt.Sprintf can be replaced with faster function strconv.Itoa"
}

0 comments on commit 71df6c3

Please sign in to comment.