aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2025-10-28 21:54:33 -0400
committerRuss Cox <rsc@golang.org>2025-10-29 11:00:09 -0700
commit49c1da474d68045458b9462b743e3f0f7dcefdfb (patch)
treeb44ac2cf3b548dd2e4bc3ab067614408ad0694eb /src/runtime/string.go
parentb2a346bbd1e1e9cb069001cf86ef39b0dd5722f8 (diff)
downloadgo-49c1da474d68045458b9462b743e3f0f7dcefdfb.tar.xz
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 <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go18
1 files changed, 9 insertions, 9 deletions
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)