diff --git a/loser/loser.go b/loser/loser.go index b02e29f6c..9da903b19 100644 --- a/loser/loser.go +++ b/loser/loser.go @@ -2,9 +2,9 @@ package loser -import "golang.org/x/exp/constraints" +import "cmp" -func New[E constraints.Ordered](lists [][]E, maxVal E) *Tree[E] { +func New[E cmp.Ordered](lists [][]E, maxVal E) *Tree[E] { nLists := len(lists) t := Tree[E]{ maxVal: maxVal, @@ -23,12 +23,12 @@ func New[E constraints.Ordered](lists [][]E, maxVal E) *Tree[E] { // A loser tree is a binary tree laid out such that nodes N and N+1 have parent N/2. // We store M leaf nodes in positions M...2M-1, and M-1 internal nodes in positions 1..M-1. // Node 0 is a special node, containing the winner of the contest. -type Tree[E constraints.Ordered] struct { +type Tree[E cmp.Ordered] struct { maxVal E nodes []node[E] } -type node[E constraints.Ordered] struct { +type node[E cmp.Ordered] struct { index int // This is the loser for all nodes except the 0th, where it is the winner. value E // Value copied from the loser node, or winner for node 0. items []E // Only populated for leaf nodes. diff --git a/loser/loser_test.go b/loser/loser_test.go index 7f19eb6c5..838867507 100644 --- a/loser/loser_test.go +++ b/loser/loser_test.go @@ -1,19 +1,19 @@ package loser_test import ( + "cmp" "fmt" "math" "math/rand" + "slices" "testing" "github.com/stretchr/testify/require" - "golang.org/x/exp/constraints" - "golang.org/x/exp/slices" "github.com/grafana/dskit/loser" ) -func checkTreeEqual[E constraints.Ordered](t *testing.T, tree *loser.Tree[E], expected []E, msg ...interface{}) { +func checkTreeEqual[E cmp.Ordered](t *testing.T, tree *loser.Tree[E], expected []E, msg ...interface{}) { t.Helper() actual := []E{} diff --git a/ring/example/local/go.mod b/ring/example/local/go.mod index 1a4c72ced..258f22f74 100644 --- a/ring/example/local/go.mod +++ b/ring/example/local/go.mod @@ -57,7 +57,6 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.17.0 // indirect - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect diff --git a/ring/partition_instance_ring.go b/ring/partition_instance_ring.go index cffa4b2fc..1702d0cd8 100644 --- a/ring/partition_instance_ring.go +++ b/ring/partition_instance_ring.go @@ -2,9 +2,8 @@ package ring import ( "fmt" + "slices" "time" - - "golang.org/x/exp/slices" ) type PartitionRingReader interface { diff --git a/ring/partition_instance_ring_test.go b/ring/partition_instance_ring_test.go index 914157340..ef29bcb0c 100644 --- a/ring/partition_instance_ring_test.go +++ b/ring/partition_instance_ring_test.go @@ -2,12 +2,12 @@ package ring import ( "fmt" + "slices" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" ) func TestPartitionInstanceRing_GetReplicationSetsForOperation(t *testing.T) { diff --git a/ring/partition_ring.go b/ring/partition_ring.go index 911de476c..21ef2d7fd 100644 --- a/ring/partition_ring.go +++ b/ring/partition_ring.go @@ -5,11 +5,10 @@ import ( "fmt" "math" "math/rand" + "slices" "strconv" "time" - "golang.org/x/exp/slices" - shardUtil "github.com/grafana/dskit/ring/shard" ) diff --git a/ring/partition_ring_http.go b/ring/partition_ring_http.go index 8e58c58c7..8fe3778eb 100644 --- a/ring/partition_ring_http.go +++ b/ring/partition_ring_http.go @@ -6,11 +6,10 @@ import ( "fmt" "html/template" "net/http" + "slices" "sort" "strconv" "time" - - "golang.org/x/exp/slices" ) //go:embed partition_ring_status.gohtml diff --git a/ring/partition_ring_model.go b/ring/partition_ring_model.go index c95380756..f957fe6b8 100644 --- a/ring/partition_ring_model.go +++ b/ring/partition_ring_model.go @@ -2,12 +2,12 @@ package ring import ( "fmt" + "slices" "strconv" "strings" "time" "github.com/gogo/protobuf/proto" - "golang.org/x/exp/slices" "github.com/grafana/dskit/kv/codec" "github.com/grafana/dskit/kv/memberlist" diff --git a/ring/partition_ring_test.go b/ring/partition_ring_test.go index 4395eed03..db75396f8 100644 --- a/ring/partition_ring_test.go +++ b/ring/partition_ring_test.go @@ -4,6 +4,7 @@ import ( "fmt" "math" "math/rand" + "slices" "strconv" "sync" "testing" @@ -12,7 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/exp/maps" - "golang.org/x/exp/slices" ) func TestPartitionRing_ActivePartitionForKey(t *testing.T) { diff --git a/ring/spread_minimizing_token_generator.go b/ring/spread_minimizing_token_generator.go index bd2ed9970..12ec23b2d 100644 --- a/ring/spread_minimizing_token_generator.go +++ b/ring/spread_minimizing_token_generator.go @@ -5,10 +5,9 @@ import ( "fmt" "math" "regexp" + "slices" "sort" "strconv" - - "golang.org/x/exp/slices" ) const ( diff --git a/ring/spread_minimizing_token_generator_test.go b/ring/spread_minimizing_token_generator_test.go index ddae2f973..912df1bfd 100644 --- a/ring/spread_minimizing_token_generator_test.go +++ b/ring/spread_minimizing_token_generator_test.go @@ -4,11 +4,11 @@ import ( "fmt" "math" "math/rand" + "slices" "testing" "time" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" ) const ( diff --git a/ring/token_range.go b/ring/token_range.go index 1020ecd33..1598defee 100644 --- a/ring/token_range.go +++ b/ring/token_range.go @@ -2,9 +2,9 @@ package ring import ( "math" + "slices" "github.com/pkg/errors" - "golang.org/x/exp/slices" // using exp/slices until moving to go 1.21. ) // TokenRanges describes token ranges owned by an instance. diff --git a/ring/util.go b/ring/util.go index a21c0f2fe..910860cc8 100644 --- a/ring/util.go +++ b/ring/util.go @@ -3,11 +3,11 @@ package ring import ( "context" "math" + "slices" "sort" "time" "github.com/go-kit/log" - "golang.org/x/exp/slices" "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/netutil"