You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem appears to be in the ToUint* functions and was introduced in commit 2b0eb0f724e320b655240e331aef36d1175986c2.
Previously, the code was:
case string:
v, err := strconv.ParseUint(s, 0, 0)
if err == nil {
return uint(v), nil
}
return 0, fmt.Errorf("unable to cast %#v to uint: %s", i, err)
But in that commit it was replaced with:
case string:
v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
if err == nil {
if v < 0 {
return 0, errNegativeNotAllowed
}
return uint(v), nil
}
return 0, fmt.Errorf("unable to cast %#v of type %T to uint", i, i)
All ToUint* functions have this bug (bad copy&paste?).
The previous code should be restored -- the only new addition is trimZeroDecimal(s), which can be added to the old code as well.
The check for negative values is also not needed if using ParseUint as before.
Result for v1.4.1:
Result for v1.5.0:
The text was updated successfully, but these errors were encountered: