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 {