chore(api)!: Error instead of returning 0 on invalid inputs to conv.* functions #2104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change, but will result in more correct rendering.
Instead of quietly returning
0
, a number of functions in theconv
namespace will now return an error if the input is invalid.This includes:
conv.ToInt64
,conv.ToInt
,conv.ToInt64s
,conv.ToInts
,conv.ToFloat64
,conv.ToFloat64s
,conv.ParseInt
,conv.ParseFloat
,conv.ParseUint
,conv.Atoi
Because these functions are used by some other functions, this introduces stricter input validation for these functions:
coll.Flatten
crypto.PBKDF2
,crypto.Bcrypt
,crypto.RSAGenerateKey
,crypto.EncryptAES
,crypto.DecryptAES
,crypto.DecryptAESBytes
math.Abs
,math.Add
,math.Mul
,math.Sub
,math.Div
,math.Rem
,math.Pow
,math.Seq
,math.Max
,math.Min
,math.Ceil
,math.Floor
,math.Round
net.CIDRHost
,net.CIDRSubnets
,net.CIDRSubnetSizes
random.ASCII
,random.Alpha
,random.AlphaNum
,random.String
,random.Number
,random.Float
regexp.FindAll
,regexp.Split
strings.Abbrev
,strings.WordWrap
time.Nanosecond
,time.Microsecond
,time.Millisecond
,time.Second
,time.Minute
,time.Hour