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 <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ruslan Semagin 2024-10-25 11:24:04 +03:00 committed by Gopher Robot
parent 4bf98186b5
commit 46b576be72

View file

@ -86,7 +86,7 @@ import (
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
"runtime/trace" "runtime/trace"
"sort" "slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -413,8 +413,8 @@ func Index(w http.ResponseWriter, r *http.Request) {
}) })
} }
sort.Slice(profiles, func(i, j int) bool { slices.SortFunc(profiles, func(a, b profileEntry) int {
return profiles[i].Name < profiles[j].Name return strings.Compare(a.Name, b.Name)
}) })
if err := indexTmplExecute(w, profiles); err != nil { if err := indexTmplExecute(w, profiles); err != nil {