mirror of
https://github.com/tinygo-org/net.git
synced 2026-08-17 11:13:25 +00:00
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:
@@ -14,7 +14,6 @@ package net
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"internal/bytealg"
|
"internal/bytealg"
|
||||||
"internal/strconv"
|
|
||||||
"internal/stringslite"
|
"internal/stringslite"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
)
|
)
|
||||||
@@ -515,7 +514,7 @@ func (n *IPNet) String() string {
|
|||||||
if l == -1 {
|
if l == -1 {
|
||||||
return nn.String() + "/" + m.String()
|
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.
|
// ParseIP parses s as an IP address, returning the result.
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build go1.26
|
||||||
|
|
||||||
|
package net
|
||||||
|
|
||||||
|
import "internal/strconv"
|
||||||
|
|
||||||
|
func netItoa(i int) string { return strconv.Itoa(i) }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build !go1.26
|
||||||
|
|
||||||
|
package net
|
||||||
|
|
||||||
|
import "internal/itoa"
|
||||||
|
|
||||||
|
func netItoa(i int) string { return itoa.Itoa(i) }
|
||||||
Reference in New Issue
Block a user