fix ToInt64E to cast value to int64 correctly on 32-bit system

ToInt64E currently try cast the value to int type, which default to int32 type
on 32-bit system and will result in potential overflow error. Fix this by
update the bitSize to 64 to cast the value to int64 on any system.
This commit is contained in:
Chris Hung 2020-11-25 15:31:28 +08:00
parent 8d17101741
commit aeeff960fc
1 changed files with 1 additions and 1 deletions

View File

@ -211,7 +211,7 @@ func ToInt64E(i interface{}) (int64, error) {
case float32:
return int64(s), nil
case string:
v, err := strconv.ParseInt(s, 0, 0)
v, err := strconv.ParseInt(s, 0, 64)
if err == nil {
return v, nil
}