From 49c1da474d68045458b9462b743e3f0f7dcefdfb Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 28 Oct 2025 21:54:33 -0400 Subject: internal/itoa, internal/runtime/strconv: delete Replaced by internal/strconv. Change-Id: I0656a9ad5075e60339e963fbae7d194d2f3e16be Reviewed-on: https://go-review.googlesource.com/c/go/+/716001 Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI --- src/runtime/string.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/runtime/string.go') diff --git a/src/runtime/string.go b/src/runtime/string.go index 3726d9235b..15b3868cbc 100644 --- a/src/runtime/string.go +++ b/src/runtime/string.go @@ -9,8 +9,8 @@ import ( "internal/bytealg" "internal/goarch" "internal/runtime/math" - "internal/runtime/strconv" "internal/runtime/sys" + "internal/strconv" "unsafe" ) @@ -420,11 +420,11 @@ func parseByteCount(s string) (int64, bool) { // Handle the easy non-suffix case. last := s[len(s)-1] if last >= '0' && last <= '9' { - n, ok := strconv.Atoi64(s) - if !ok || n < 0 { + n, err := strconv.ParseInt(s, 10, 64) + if err != nil || n < 0 { return 0, false } - return n, ok + return n, true } // Failing a trailing digit, this must always end in 'B'. // Also at this point there must be at least one digit before @@ -435,11 +435,11 @@ func parseByteCount(s string) (int64, bool) { // The one before that must always be a digit or 'i'. if c := s[len(s)-2]; c >= '0' && c <= '9' { // Trivial 'B' suffix. - n, ok := strconv.Atoi64(s[:len(s)-1]) - if !ok || n < 0 { + n, err := strconv.ParseInt(s[:len(s)-1], 10, 64) + if err != nil || n < 0 { return 0, false } - return n, ok + return n, true } else if c != 'i' { return 0, false } @@ -466,8 +466,8 @@ func parseByteCount(s string) (int64, bool) { for i := 0; i < power; i++ { m *= 1024 } - n, ok := strconv.Atoi64(s[:len(s)-3]) - if !ok || n < 0 { + n, err := strconv.ParseInt(s[:len(s)-3], 10, 64) + if err != nil || n < 0 { return 0, false } un := uint64(n) -- cgit v1.3-5-g9baa