From 46b576be724b6e64359fd872b9bd5109aba93cc0 Mon Sep 17 00:00:00 2001 From: Ruslan Semagin Date: Fri, 25 Oct 2024 11:24:04 +0300 Subject: [PATCH] net/http/pprof: replace sort.Slice with slices.SortFunc Change-Id: Ie416ed0d7abcb64e63d999b8cee5975a0fc13875 Reviewed-on: https://go-review.googlesource.com/c/go/+/622496 Auto-Submit: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Commit-Queue: Ian Lance Taylor Reviewed-by: Cherry Mui Reviewed-by: Ian Lance Taylor --- src/net/http/pprof/pprof.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index be3e44c6d23eca..6ba6b2c8e033b9 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -86,7 +86,7 @@ import ( "runtime" "runtime/pprof" "runtime/trace" - "sort" + "slices" "strconv" "strings" "time" @@ -413,8 +413,8 @@ func Index(w http.ResponseWriter, r *http.Request) { }) } - sort.Slice(profiles, func(i, j int) bool { - return profiles[i].Name < profiles[j].Name + slices.SortFunc(profiles, func(a, b profileEntry) int { + return strings.Compare(a.Name, b.Name) }) if err := indexTmplExecute(w, profiles); err != nil {