-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
@achille-roussel I'm eventually hoping to clean up a particular lint related to this code:
if v < math.MinInt64 || v > math.MaxInt64 {
return r, unmarshalOverflow(b[:len(b)-len(r)], int32Type)
}v in this case, is of type int64, thus the following lint seems accurate:
json/decode.go:453:6: SA4003: no value of type int64 is less than math.MinInt64 (staticcheck)
I can easily enough remove the entire branch, since it'd never evaluate anyways (and might even be eliminated during compilation), but the presence of the use of int32Type raises some questions:
- Should these be comparisons against
MinInt32/MaxInt32? - Is this code assuming that
vis of typeint32(if not, why isint32Typebeing used)? - What's the actual intended behavior? Since
time.Duration's underlying type isint64, it would seem thatdecoder.parseIntshould sufficiently cover any overflow checking need.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels