File tree Expand file tree Collapse file tree 5 files changed +33
-0
lines changed Expand file tree Collapse file tree 5 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ require (
27
27
github.com/breml/errchkjson v0.3.6
28
28
github.com/butuzov/ireturn v0.2.0
29
29
github.com/butuzov/mirror v1.1.0
30
+ github.com/catenacyber/gostrconv v0.1.0
30
31
github.com/charithe/durationcheck v0.0.10
31
32
github.com/curioswitch/go-reassign v0.2.0
32
33
github.com/daixiang0/gci v0.11.2
Original file line number Diff line number Diff line change
1
+ package golinters
2
+
3
+ import (
4
+ "github.com/catenacyber/gostrconv/analyzer"
5
+ "golang.org/x/tools/go/analysis"
6
+
7
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8
+ )
9
+
10
+ func NewGoStrconv () * goanalysis.Linter {
11
+ return goanalysis .NewLinter (
12
+ "gostrconv" ,
13
+ "Checks that fmt.Sprintf can be can be replaced with a faster strconv function." ,
14
+ []* analysis.Analyzer {analyzer .Analyzer },
15
+ nil ,
16
+ ).WithLoadMode (goanalysis .LoadModeSyntax )
17
+ }
Original file line number Diff line number Diff line change @@ -532,6 +532,11 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
532
532
WithPresets (linter .PresetStyle ).
533
533
WithURL ("https://github.com/jirfag/go-printf-func-name" ),
534
534
535
+ linter .NewConfig (golinters .NewGoStrconv ()).
536
+ WithSince ("v1.53.0" ).
537
+ WithPresets (linter .PresetStyle ).
538
+ WithURL ("https://github.com/catenacyber/gostrconv" ),
539
+
535
540
linter .NewConfig (golinters .NewGosec (gosecCfg )).
536
541
WithSince ("v1.0.0" ).
537
542
WithLoadForGoAnalysis ().
Original file line number Diff line number Diff line change
1
+ //golangcitest:args -Egostrconv
2
+ package testdata
3
+
4
+ import "fmt"
5
+
6
+ func SprintfCouldBeStrconv () {
7
+ fmt .Sprintf ("%d" , 42 ) // want "Sprintf can be replaced with faster function from strconv"
8
+ }
You can’t perform that action at this time.
0 commit comments