aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/error.go')
-rw-r--r--src/runtime/error.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/runtime/error.go b/src/runtime/error.go
index e1291e1543..4b6fb32b78 100644
--- a/src/runtime/error.go
+++ b/src/runtime/error.go
@@ -4,7 +4,7 @@
package runtime
-import _ "unsafe" // for go:linkname
+import "internal/bytealg"
// The Error interface identifies a run time error.
type Error interface {
@@ -118,11 +118,6 @@ func printany(i interface{}) {
}
}
-// strings.IndexByte is implemented in runtime/asm_$goarch.s
-// but amusingly we need go:linkname to get access to it here in the runtime.
-//go:linkname stringsIndexByte strings.IndexByte
-func stringsIndexByte(s string, c byte) int
-
// panicwrap generates a panic for a call to a wrapped value method
// with a nil pointer receiver.
//
@@ -133,7 +128,7 @@ func panicwrap() {
// name is something like "main.(*T).F".
// We want to extract pkg ("main"), typ ("T"), and meth ("F").
// Do it by finding the parens.
- i := stringsIndexByte(name, '(')
+ i := bytealg.IndexByteString(name, '(')
if i < 0 {
throw("panicwrap: no ( in " + name)
}
@@ -142,7 +137,7 @@ func panicwrap() {
throw("panicwrap: unexpected string after package name: " + name)
}
name = name[i+2:]
- i = stringsIndexByte(name, ')')
+ i = bytealg.IndexByteString(name, ')')
if i < 0 {
throw("panicwrap: no ) in " + name)
}