app/vmalert/datasource: substitute golang.org/x/exp/slices.SortFunc with sort.Slice

This removes unnecessary third-party dependency on golang.org/x/exp.

This is a follow-up for da60a68d09
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2945
This commit is contained in:
Aliaksandr Valialkin 2023-07-24 18:56:28 -07:00
parent 6b6b61137f
commit 56c17d16f6
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 4 additions and 8 deletions

View file

@ -5,10 +5,9 @@ import (
"context" "context"
"net/http" "net/http"
"net/url" "net/url"
"sort"
"strconv" "strconv"
"time" "time"
"golang.org/x/exp/slices"
) )
// Querier interface wraps Query and QueryRange methods // Querier interface wraps Query and QueryRange methods
@ -175,6 +174,6 @@ func ConvertToLabels(m map[string]string) (labelset Labels) {
}) })
} }
// sort label // sort label
slices.SortFunc(labelset, func(a, b Label) bool { return a.Name < b.Name }) sort.Slice(labelset, func(i, j int) bool { return labelset[i].Name < labelset[j].Name })
return return
} }

7
go.mod
View file

@ -17,6 +17,7 @@ require (
github.com/aws/aws-sdk-go-v2/config v1.18.28 github.com/aws/aws-sdk-go-v2/config v1.18.28
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72
github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0
github.com/bmatcuk/doublestar/v4 v4.6.0
github.com/cespare/xxhash/v2 v2.2.0 github.com/cespare/xxhash/v2 v2.2.0
github.com/cheggaaa/pb/v3 v3.1.4 github.com/cheggaaa/pb/v3 v3.1.4
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2
@ -39,11 +40,6 @@ require (
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )
require (
github.com/bmatcuk/doublestar/v4 v4.6.0
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
)
require ( require (
cloud.google.com/go v0.110.6 // indirect cloud.google.com/go v0.110.6 // indirect
cloud.google.com/go/compute v1.22.0 // indirect cloud.google.com/go/compute v1.22.0 // indirect
@ -118,6 +114,7 @@ require (
go.uber.org/atomic v1.11.0 // indirect go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.2.1 // indirect go.uber.org/goleak v1.2.1 // indirect
golang.org/x/crypto v0.11.0 // indirect golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/sync v0.3.0 // indirect golang.org/x/sync v0.3.0 // indirect
golang.org/x/text v0.11.0 // indirect golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect golang.org/x/time v0.3.0 // indirect