go-mnd
go-mnd copied to clipboard
`strconv.FormatInt` or `strconv.FormatUint` and magic numbers ?
Become curious: should any number (within consition 2 <= n <= 36
) be considered as magic number if used in strconv.FormatInt
or strconv.FormatUint
?
I have the same issue with strconv.ParseFloat
, where the argument bitSize
is considered as magic number even though the only two valid values are 32
and 64
.
@butuzov @breml
got same issue with gomnd / staticcheck
.....go:413:53: mnd: Magic number: 64, in <argument> detected (gomnd)
lon, err := strconv.ParseFloat(*addr.Data.GeoLon, 64)
^
....go:91:43: SA1030: 'fmt' argument is invalid: unknown format '\n' (staticcheck)
lat := strconv.FormatFloat(*ts.Lot.Lat, 10, 5, 64)
^
Rollback to golangci-lint v1.40.1 helped
- remove currently installed golangci-lint
- install v1.40.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.1
@solokirrik bad advice considering improvements in 1.43
and backwards compatibility for go versions.
@butuzov agree, but that's how it works now wo PR in go-mnd
Before PR we might need a comment from @tommy-muehle.
and looks like a way to ignore such patterns was just added
@tommy-muehle could you please tag a new version with built-in functions fix? #29
+1 to @solokirrik, because support to ignored-functions
just landed to golangci-lint
json schema (but not golangci-lint
itself)
Sure. Thanks for the heads up @solokirrik @butuzov !