]> Cypherpunks repositories - gostls13.git/commitdiff
net/http/pprof: replace sort.Slice with slices.SortFunc
authorRuslan Semagin <pixel.365.24@gmail.com>
Fri, 25 Oct 2024 08:24:04 +0000 (11:24 +0300)
committerGopher Robot <gobot@golang.org>
Fri, 25 Oct 2024 21:42:41 +0000 (21:42 +0000)
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>
src/net/http/pprof/pprof.go

index be3e44c6d23eca57e9c6cc7c20427343acf8a8e2..6ba6b2c8e033b95f2297e82929ac73c6d85cfa61 100644 (file)
@@ -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 {