Skip to content

Commit

Permalink
replace sort.Slice with slices.SortFunc
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 committed Dec 3, 2023
1 parent d93db7e commit 971f264
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"flag"
"fmt"
io "io"
"io"
"net/http"
"sort"
"strings"
Expand All @@ -25,6 +25,7 @@ import (
"github.com/weaveworks/common/instrument"
"github.com/weaveworks/common/user"
"go.uber.org/atomic"
"golang.org/x/exp/slices"

"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/ha"
Expand Down Expand Up @@ -873,8 +874,8 @@ func sortLabelsIfNeeded(labels []cortexpb.LabelAdapter) {
return
}

sort.Slice(labels, func(i, j int) bool {
return strings.Compare(labels[i].Name, labels[j].Name) < 0
slices.SortFunc(labels, func(a, b cortexpb.LabelAdapter) int {
return strings.Compare(a.Name, b.Name)
})
}

Expand Down

0 comments on commit 971f264

Please sign in to comment.