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:
Ayke van Laethem
2019-05-24 14:35:17 +02:00
committed by Ron Evans
parent 7e6a54ac62
commit f2cd4d12e8
5 changed files with 26 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
// +build !go1.12
package runtime
// indexByte provides compatibility with Go 1.11.
// See the following:
// https://github.com/tinygo-org/tinygo/issues/351
// https://github.com/golang/go/commit/ad4a58e31501bce5de2aad90a620eaecdc1eecb8
//go:linkname indexByte strings.IndexByte
func indexByte(s string, c byte) int {
return indexByteString(s, c)
}