mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
compiler,runtime: fix multiple definitions of a single function
strings.IndexByte was implemented in the runtime up to Go 1.11. It is implemented using a direct call to internal/bytealg.IndexByte since Go 1.12. Make sure we remain compatible with both.
This commit is contained in:
committed by
Ron Evans
parent
7e6a54ac62
commit
f2cd4d12e8
@@ -166,9 +166,10 @@ func decodeUTF8(s string, index uintptr) (rune, uintptr) {
|
||||
}
|
||||
}
|
||||
|
||||
// indexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
|
||||
//go:linkname indexByte strings.IndexByte
|
||||
func indexByte(s string, c byte) int {
|
||||
// indexByteString returns the index of the first instance of c in s, or -1 if c
|
||||
// is not present in s.
|
||||
//go:linkname indexByteString internal/bytealg.IndexByteString
|
||||
func indexByteString(s string, c byte) int {
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == c {
|
||||
return i
|
||||
|
||||
Reference in New Issue
Block a user