aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorcuishuang <imcusg@gmail.com>2025-03-31 18:46:54 +0800
committerGopher Robot <gobot@golang.org>2025-04-06 09:36:41 -0700
commit6fd9ee3da9dc5570f66735e835cac2d66a0f6244 (patch)
tree79f688d7edf23e21920ac8906a222fbdff4678e2 /src/runtime
parent1647896aa227d8546de3dbe70a5049eecee964e3 (diff)
downloadgo-6fd9ee3da9dc5570f66735e835cac2d66a0f6244.tar.xz
all: use slices.Equal to simplify code
Change-Id: Ib3be7cee6ca6dce899805aac176ca789eb2fd0f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/661738 Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/pprof/pprof_test.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index 4b8f29c918..5477d9ed26 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -2558,15 +2558,7 @@ func TestProfilerStackDepth(t *testing.T) {
}
func hasPrefix(stk []string, prefix []string) bool {
- if len(prefix) > len(stk) {
- return false
- }
- for i := range prefix {
- if stk[i] != prefix[i] {
- return false
- }
- }
- return true
+ return len(prefix) <= len(stk) && slices.Equal(stk[:len(prefix)], prefix)
}
// ensure that stack records are valid map keys (comparable)