From 56c17d16f6837d6b9fc89a506b4f62ab54df9add Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 24 Jul 2023 18:56:28 -0700 Subject: [PATCH] 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 da60a68d09b7cf4eb371783062b30a22d24656b1 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2945 --- app/vmalert/datasource/datasource.go | 5 ++--- go.mod | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/vmalert/datasource/datasource.go b/app/vmalert/datasource/datasource.go index 2e90e1848..31e4689c4 100644 --- a/app/vmalert/datasource/datasource.go +++ b/app/vmalert/datasource/datasource.go @@ -5,10 +5,9 @@ import ( "context" "net/http" "net/url" + "sort" "strconv" "time" - - "golang.org/x/exp/slices" ) // Querier interface wraps Query and QueryRange methods @@ -175,6 +174,6 @@ func ConvertToLabels(m map[string]string) (labelset Labels) { }) } // 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 } diff --git a/go.mod b/go.mod index 45bc9ed2e..887c249dd 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( 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/service/s3 v1.37.0 + github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/cespare/xxhash/v2 v2.2.0 github.com/cheggaaa/pb/v3 v3.1.4 github.com/gogo/protobuf v1.3.2 @@ -39,11 +40,6 @@ require ( 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 ( cloud.google.com/go v0.110.6 // 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/goleak v1.2.1 // 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/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect