From 6fd9ee3da9dc5570f66735e835cac2d66a0f6244 Mon Sep 17 00:00:00 2001 From: cuishuang Date: Mon, 31 Mar 2025 18:46:54 +0800 Subject: all: use slices.Equal to simplify code Change-Id: Ib3be7cee6ca6dce899805aac176ca789eb2fd0f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/661738 Reviewed-by: Carlos Amedee Auto-Submit: Sean Liao LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- src/runtime/pprof/pprof_test.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/runtime/pprof') 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) -- cgit v1.3-6-g1900