From 855218d797db2ba8027c80a31df1b7e43fa11bd6 Mon Sep 17 00:00:00 2001 From: lr123liurui <835646775@qq.com> Date: Mon, 6 Mar 2023 20:49:50 +0800 Subject: [PATCH] fix cast.ToUint64 12344423419941918335 return 0 --- caste.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/caste.go b/caste.go index bccf27a..c690587 100644 --- a/caste.go +++ b/caste.go @@ -598,12 +598,12 @@ func ToUint64E(i interface{}) (uint64, error) { switch s := i.(type) { case string: - v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0) + v, err := strconv.ParseUint(trimZeroDecimal(s), 0, 0) if err == nil { if v < 0 { return 0, errNegativeNotAllowed } - return uint64(v), nil + return v, nil } return 0, fmt.Errorf("unable to cast %#v of type %T to uint64", i, i) case json.Number: