Skip to content

Commit 86c7103

Browse files
committed
Ignore some strconv functions by default, fixes #27
1 parent 10a50fc commit 86c7103

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func DefaultConfig() *Config {
2828
},
2929
IgnoredFunctions: []*regexp.Regexp{
3030
regexp.MustCompile(`time.Date`),
31+
regexp.MustCompile(`strconv.FormatInt`),
32+
regexp.MustCompile(`strconv.FormatUint`),
33+
regexp.MustCompile(`strconv.FormatFloat`),
34+
regexp.MustCompile(`strconv.ParseInt`),
35+
regexp.MustCompile(`strconv.ParseUint`),
36+
regexp.MustCompile(`strconv.ParseFloat`),
3137
},
3238
}
3339
}

testdata/src/argument/argument.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"math"
66
"net/http"
77
"os"
8+
"strconv"
89
"strings"
910
"sync"
1011
"time"
@@ -92,3 +93,15 @@ func foobaz(numbers ...int) {}
9293
func example12() {
9394
foobaz(0, 1, 3, 5, 6) // want "Magic number: 3" "Magic number: 5" "Magic number: 6"
9495
}
96+
97+
func example13() {
98+
strconv.FormatInt(10, 32)
99+
strconv.FormatUint(5, 32)
100+
strconv.FormatFloat(5.0, 'E', -1, 32)
101+
}
102+
103+
func example14() {
104+
_, _ = strconv.ParseInt("10", 10, 64)
105+
_, _ = strconv.ParseUint("5", 10, 64)
106+
_, _ = strconv.ParseFloat("5.0", 32)
107+
}

0 commit comments

Comments
 (0)