]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use stringslite.CutPrefix in isExportedRuntime
authorTobias Klauser <tklauser@distanz.ch>
Fri, 4 Oct 2024 12:30:06 +0000 (14:30 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 4 Oct 2024 19:47:10 +0000 (19:47 +0000)
Change-Id: I7cbbe3b9a9f08ac98e3e76be7bda2f7df9c61fb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/617915
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/traceback.go

index 95a57bd2b729516cb62097e258be1ad7e7e9b719..3c2092ed9970e47a0bb8d9a16e2c4c548bec6afe 100644 (file)
@@ -1149,11 +1149,10 @@ func showfuncinfo(sf srcFunc, firstFrame bool, calleeID abi.FuncID) bool {
 // It is only for runtime functions, so ASCII A-Z is fine.
 func isExportedRuntime(name string) bool {
        // Check and remove package qualifier.
-       n := len("runtime.")
-       if len(name) <= n || name[:n] != "runtime." {
+       name, found := stringslite.CutPrefix(name, "runtime.")
+       if !found {
                return false
        }
-       name = name[n:]
        rcvr := ""
 
        // Extract receiver type, if any.