net: use internal/itoa for Go < 1.26 to fix build with older Go versions

internal/strconv was added in Go 1.26. For older Go versions, use
internal/itoa (already present in TinyGo) via a build tag shim.

Fixes TinyGo #5332

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2026-04-22 11:38:51 +02:00
committed by Ron Evans
parent b2d3a2b05b
commit e54965ed5e
3 changed files with 15 additions and 2 deletions
+1 -2
View File
@@ -14,7 +14,6 @@ package net
import (
"internal/bytealg"
"internal/strconv"
"internal/stringslite"
"net/netip"
)
@@ -515,7 +514,7 @@ func (n *IPNet) String() string {
if l == -1 {
return nn.String() + "/" + m.String()
}
return nn.String() + "/" + strconv.Itoa(l)
return nn.String() + "/" + netItoa(l)
}
// ParseIP parses s as an IP address, returning the result.
+7
View File
@@ -0,0 +1,7 @@
//go:build go1.26
package net
import "internal/strconv"
func netItoa(i int) string { return strconv.Itoa(i) }
+7
View File
@@ -0,0 +1,7 @@
//go:build !go1.26
package net
import "internal/itoa"
func netItoa(i int) string { return itoa.Itoa(i) }