From: Ruslan Semagin Date: Fri, 25 Oct 2024 08:24:04 +0000 (+0300) Subject: net/http/pprof: replace sort.Slice with slices.SortFunc X-Git-Tag: go1.24rc1~588 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=46b576be724b6e64359fd872b9bd5109aba93cc0;p=gostls13.git 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 --- diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index be3e44c6d2..6ba6b2c8e0 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 {