From 852a60d5208bc8faab70eb5ea589e944d4d64db4 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 7 Mar 2018 11:56:24 +0200 Subject: [PATCH] Fix go vet --- bench_test.go | 6 +- cluster_test.go | 68 +++- commands_test.go | 695 +++++++++++++++++++++----------- example_instrumentation_test.go | 2 +- 4 files changed, 537 insertions(+), 234 deletions(-) diff --git a/bench_test.go b/bench_test.go index f6b75c72..b7c4081e 100644 --- a/bench_test.go +++ b/bench_test.go @@ -208,7 +208,11 @@ func BenchmarkZAdd(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { - if err := client.ZAdd("key", redis.Z{float64(1), "hello"}).Err(); err != nil { + err := client.ZAdd("key", redis.Z{ + Score: float64(1), + Member: "hello", + }).Err() + if err != nil { b.Fatal(err) } } diff --git a/cluster_test.go b/cluster_test.go index 2bf5d916..6788599a 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -123,9 +123,37 @@ func startCluster(scenario *clusterScenario) error { return err } wanted := []redis.ClusterSlot{ - {0, 4999, []redis.ClusterNode{{"", "127.0.0.1:8220"}, {"", "127.0.0.1:8223"}}}, - {5000, 9999, []redis.ClusterNode{{"", "127.0.0.1:8221"}, {"", "127.0.0.1:8224"}}}, - {10000, 16383, []redis.ClusterNode{{"", "127.0.0.1:8222"}, {"", "127.0.0.1:8225"}}}, + { + Start: 0, + End: 4999, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8220", + }, { + Id: "", + Addr: "127.0.0.1:8223", + }}, + }, { + Start: 5000, + End: 9999, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8221", + }, { + Id: "", + Addr: "127.0.0.1:8224", + }}, + }, { + Start: 10000, + End: 16383, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8222", + }, { + Id: "", + Addr: "127.0.0.1:8225", + }}, + }, } return assertSlotsEqual(res, wanted) }, 30*time.Second) @@ -492,9 +520,37 @@ var _ = Describe("ClusterClient", func() { Expect(res).To(HaveLen(3)) wanted := []redis.ClusterSlot{ - {0, 4999, []redis.ClusterNode{{"", "127.0.0.1:8220"}, {"", "127.0.0.1:8223"}}}, - {5000, 9999, []redis.ClusterNode{{"", "127.0.0.1:8221"}, {"", "127.0.0.1:8224"}}}, - {10000, 16383, []redis.ClusterNode{{"", "127.0.0.1:8222"}, {"", "127.0.0.1:8225"}}}, + { + Start: 0, + End: 4999, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8220", + }, { + Id: "", + Addr: "127.0.0.1:8223", + }}, + }, { + Start: 5000, + End: 9999, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8221", + }, { + Id: "", + Addr: "127.0.0.1:8224", + }}, + }, { + Start: 10000, + End: 16383, + Nodes: []redis.ClusterNode{{ + Id: "", + Addr: "127.0.0.1:8222", + }, { + Id: "", + Addr: "127.0.0.1:8225", + }}, + }, } Expect(assertSlotsEqual(res, wanted)).NotTo(HaveOccurred()) }) diff --git a/commands_test.go b/commands_test.go index a4e5250d..5e4d260f 100644 --- a/commands_test.go +++ b/commands_test.go @@ -753,8 +753,11 @@ var _ = Describe("Commands", func() { It("should ZScan", func() { for i := 0; i < 1000; i++ { - sadd := client.ZAdd("myset", redis.Z{float64(i), fmt.Sprintf("member%d", i)}) - Expect(sadd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("myset", redis.Z{ + Score: float64(i), + Member: fmt.Sprintf("member%d", i), + }).Err() + Expect(err).NotTo(HaveOccurred()) } keys, cursor, err := client.ZScan("myset", 0, "", 0).Result() @@ -794,11 +797,17 @@ var _ = Describe("Commands", func() { Expect(bitCount.Err()).NotTo(HaveOccurred()) Expect(bitCount.Val()).To(Equal(int64(26))) - bitCount = client.BitCount("key", &redis.BitCount{0, 0}) + bitCount = client.BitCount("key", &redis.BitCount{ + Start: 0, + End: 0, + }) Expect(bitCount.Err()).NotTo(HaveOccurred()) Expect(bitCount.Val()).To(Equal(int64(4))) - bitCount = client.BitCount("key", &redis.BitCount{1, 1}) + bitCount = client.BitCount("key", &redis.BitCount{ + Start: 1, + End: 1, + }) Expect(bitCount.Err()).NotTo(HaveOccurred()) Expect(bitCount.Val()).To(Equal(int64(6))) }) @@ -2076,69 +2085,120 @@ var _ = Describe("Commands", func() { Describe("sorted sets", func() { It("should ZAdd", func() { - added, err := client.ZAdd("zset", redis.Z{1, "one"}).Result() + added, err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{1, "uno"}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "uno", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{2, "two"}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 2, + Member: "two", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{3, "two"}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 3, + Member: "two", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(0))) vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}, {1, "uno"}, {3, "two"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 1, + Member: "uno", + }, { + Score: 3, + Member: "two", + }})) }) It("should ZAdd bytes", func() { - added, err := client.ZAdd("zset", redis.Z{1, []byte("one")}).Result() + added, err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: []byte("one"), + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{1, []byte("uno")}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 1, + Member: []byte("uno"), + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{2, []byte("two")}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 2, + Member: []byte("two"), + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAdd("zset", redis.Z{3, []byte("two")}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 3, + Member: []byte("two"), + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(0))) - val, err := client.ZRangeWithScores("zset", 0, -1).Result() + vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}, {1, "uno"}, {3, "two"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 1, + Member: "uno", + }, { + Score: 3, + Member: "two", + }})) }) It("should ZAddNX", func() { - added, err := client.ZAddNX("zset", redis.Z{1, "one"}).Result() + added, err := client.ZAddNX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) - added, err = client.ZAddNX("zset", redis.Z{2, "one"}).Result() + added, err = client.ZAddNX("zset", redis.Z{ + Score: 2, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(0))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) }) It("should ZAddXX", func() { - added, err := client.ZAddXX("zset", redis.Z{1, "one"}).Result() + added, err := client.ZAddXX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(0))) @@ -2146,49 +2206,73 @@ var _ = Describe("Commands", func() { Expect(err).NotTo(HaveOccurred()) Expect(vals).To(BeEmpty()) - added, err = client.ZAdd("zset", redis.Z{1, "one"}).Result() + added, err = client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - added, err = client.ZAddXX("zset", redis.Z{2, "one"}).Result() + added, err = client.ZAddXX("zset", redis.Z{ + Score: 2, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(0))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{2, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "one"}})) }) It("should ZAddCh", func() { - changed, err := client.ZAddCh("zset", redis.Z{1, "one"}).Result() + changed, err := client.ZAddCh("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(1))) - changed, err = client.ZAddCh("zset", redis.Z{1, "one"}).Result() + changed, err = client.ZAddCh("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(0))) }) It("should ZAddNXCh", func() { - changed, err := client.ZAddNXCh("zset", redis.Z{1, "one"}).Result() + changed, err := client.ZAddNXCh("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(1))) vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) - changed, err = client.ZAddNXCh("zset", redis.Z{2, "one"}).Result() + changed, err = client.ZAddNXCh("zset", redis.Z{ + Score: 2, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(0))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }})) }) It("should ZAddXXCh", func() { - changed, err := client.ZAddXXCh("zset", redis.Z{1, "one"}).Result() + changed, err := client.ZAddXXCh("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(0))) @@ -2196,57 +2280,75 @@ var _ = Describe("Commands", func() { Expect(err).NotTo(HaveOccurred()) Expect(vals).To(BeEmpty()) - added, err := client.ZAdd("zset", redis.Z{1, "one"}).Result() + added, err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - changed, err = client.ZAddXXCh("zset", redis.Z{2, "one"}).Result() + changed, err = client.ZAddXXCh("zset", redis.Z{ + Score: 2, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(changed).To(Equal(int64(1))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{2, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "one"}})) }) It("should ZIncr", func() { - score, err := client.ZIncr("zset", redis.Z{1, "one"}).Result() + score, err := client.ZIncr("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(score).To(Equal(float64(1))) vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) - score, err = client.ZIncr("zset", redis.Z{1, "one"}).Result() + score, err = client.ZIncr("zset", redis.Z{Score: 1, Member: "one"}).Result() Expect(err).NotTo(HaveOccurred()) Expect(score).To(Equal(float64(2))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{2, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "one"}})) }) It("should ZIncrNX", func() { - score, err := client.ZIncrNX("zset", redis.Z{1, "one"}).Result() + score, err := client.ZIncrNX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(score).To(Equal(float64(1))) vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) - score, err = client.ZIncrNX("zset", redis.Z{1, "one"}).Result() + score, err = client.ZIncrNX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).To(Equal(redis.Nil)) Expect(score).To(Equal(float64(0))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) }) It("should ZIncrXX", func() { - score, err := client.ZIncrXX("zset", redis.Z{1, "one"}).Result() + score, err := client.ZIncrXX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).To(Equal(redis.Nil)) Expect(score).To(Equal(float64(0))) @@ -2254,36 +2356,57 @@ var _ = Describe("Commands", func() { Expect(err).NotTo(HaveOccurred()) Expect(vals).To(BeEmpty()) - added, err := client.ZAdd("zset", redis.Z{1, "one"}).Result() + added, err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(added).To(Equal(int64(1))) - score, err = client.ZIncrXX("zset", redis.Z{1, "one"}).Result() + score, err = client.ZIncrXX("zset", redis.Z{ + Score: 1, + Member: "one", + }).Result() Expect(err).NotTo(HaveOccurred()) Expect(score).To(Equal(float64(2))) vals, err = client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{2, "one"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "one"}})) }) It("should ZCard", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{ + Score: 2, + Member: "two", + }).Err() + Expect(err).NotTo(HaveOccurred()) - zCard := client.ZCard("zset") - Expect(zCard.Err()).NotTo(HaveOccurred()) - Expect(zCard.Val()).To(Equal(int64(2))) + card, err := client.ZCard("zset").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(card).To(Equal(int64(2))) }) It("should ZCount", func() { - err := client.ZAdd("zset", redis.Z{1, "one"}).Err() + err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Err() Expect(err).NotTo(HaveOccurred()) - err = client.ZAdd("zset", redis.Z{2, "two"}).Err() + err = client.ZAdd("zset", redis.Z{ + Score: 2, + Member: "two", + }).Err() Expect(err).NotTo(HaveOccurred()) - err = client.ZAdd("zset", redis.Z{3, "three"}).Err() + err = client.ZAdd("zset", redis.Z{ + Score: 3, + Member: "three", + }).Err() Expect(err).NotTo(HaveOccurred()) count, err := client.ZCount("zset", "-inf", "+inf").Result() @@ -2300,50 +2423,74 @@ var _ = Describe("Commands", func() { }) It("should ZIncrBy", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{ + Score: 1, + Member: "one", + }).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{ + Score: 2, + Member: "two", + }).Err() + Expect(err).NotTo(HaveOccurred()) - zIncrBy := client.ZIncrBy("zset", 2, "one") - Expect(zIncrBy.Err()).NotTo(HaveOccurred()) - Expect(zIncrBy.Val()).To(Equal(float64(3))) + n, err := client.ZIncrBy("zset", 2, "one").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(n).To(Equal(float64(3))) val, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}, {3, "one"}})) + Expect(val).To(Equal([]redis.Z{{ + Score: 2, + Member: "two", + }, { + Score: 3, + Member: "one", + }})) }) It("should ZInterStore", func() { - zAdd := client.ZAdd("zset1", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset1", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset1", redis.Z{ + Score: 1, + Member: "one", + }).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset1", redis.Z{ + Score: 2, + Member: "two", + }).Err() + Expect(err).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset2", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset2", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset3", redis.Z{3, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err = client.ZAdd("zset2", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset2", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset3", redis.Z{Score: 3, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) zInterStore := client.ZInterStore( "out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2") Expect(zInterStore.Err()).NotTo(HaveOccurred()) Expect(zInterStore.Val()).To(Equal(int64(2))) - val, err := client.ZRangeWithScores("out", 0, -1).Result() + vals, err := client.ZRangeWithScores("out", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{5, "one"}, {10, "two"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 5, + Member: "one", + }, { + Score: 10, + Member: "two", + }})) }) It("should ZRange", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRange := client.ZRange("zset", 0, -1) Expect(zRange.Err()).NotTo(HaveOccurred()) @@ -2359,33 +2506,48 @@ var _ = Describe("Commands", func() { }) It("should ZRangeWithScores", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - - val, err := client.ZRangeWithScores("zset", 0, -1).Result() + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}, {2, "two"}, {3, "three"}})) - - val, err = client.ZRangeWithScores("zset", 2, 3).Result() + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{3, "three"}})) - - val, err = client.ZRangeWithScores("zset", -2, -1).Result() + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}, {3, "three"}})) + + vals, err := client.ZRangeWithScores("zset", 0, -1).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 2, + Member: "two", + }, { + Score: 3, + Member: "three", + }})) + + vals, err = client.ZRangeWithScores("zset", 2, 3).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(vals).To(Equal([]redis.Z{{Score: 3, Member: "three"}})) + + vals, err = client.ZRangeWithScores("zset", -2, -1).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(vals).To(Equal([]redis.Z{{ + Score: 2, + Member: "two", + }, { + Score: 3, + Member: "three", + }})) }) It("should ZRangeByScore", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRangeByScore := client.ZRangeByScore("zset", redis.ZRangeBy{ Min: "-inf", @@ -2417,12 +2579,21 @@ var _ = Describe("Commands", func() { }) It("should ZRangeByLex", func() { - zAdd := client.ZAdd("zset", redis.Z{0, "a"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{0, "b"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{0, "c"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{ + Score: 0, + Member: "a", + }).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{ + Score: 0, + Member: "b", + }).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{ + Score: 0, + Member: "c", + }).Err() + Expect(err).NotTo(HaveOccurred()) zRangeByLex := client.ZRangeByLex("zset", redis.ZRangeBy{ Min: "-", @@ -2454,49 +2625,64 @@ var _ = Describe("Commands", func() { }) It("should ZRangeByScoreWithScoresMap", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) - val, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ + vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ Min: "-inf", Max: "+inf", }).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}, {2, "two"}, {3, "three"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 2, + Member: "two", + }, { + Score: 3, + Member: "three", + }})) - val, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ + vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ Min: "1", Max: "2", }).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}, {2, "two"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 2, + Member: "two", + }})) - val, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ + vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ Min: "(1", Max: "2", }).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}})) - val, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ + vals, err = client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{ Min: "(1", Max: "(2", }).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{})) + Expect(vals).To(Equal([]redis.Z{})) }) It("should ZRank", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRank := client.ZRank("zset", "three") Expect(zRank.Err()).NotTo(HaveOccurred()) @@ -2508,68 +2694,83 @@ var _ = Describe("Commands", func() { }) It("should ZRem", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRem := client.ZRem("zset", "two") Expect(zRem.Err()).NotTo(HaveOccurred()) Expect(zRem.Val()).To(Equal(int64(1))) - val, err := client.ZRangeWithScores("zset", 0, -1).Result() + vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}, {3, "three"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 1, + Member: "one", + }, { + Score: 3, + Member: "three", + }})) }) It("should ZRemRangeByRank", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRemRangeByRank := client.ZRemRangeByRank("zset", 0, 1) Expect(zRemRangeByRank.Err()).NotTo(HaveOccurred()) Expect(zRemRangeByRank.Val()).To(Equal(int64(2))) - val, err := client.ZRangeWithScores("zset", 0, -1).Result() + vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{3, "three"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 3, + Member: "three", + }})) }) It("should ZRemRangeByScore", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRemRangeByScore := client.ZRemRangeByScore("zset", "-inf", "(2") Expect(zRemRangeByScore.Err()).NotTo(HaveOccurred()) Expect(zRemRangeByScore.Val()).To(Equal(int64(1))) - val, err := client.ZRangeWithScores("zset", 0, -1).Result() + vals, err := client.ZRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}, {3, "three"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 2, + Member: "two", + }, { + Score: 3, + Member: "three", + }})) }) It("should ZRemRangeByLex", func() { zz := []redis.Z{ - {0, "aaaa"}, - {0, "b"}, - {0, "c"}, - {0, "d"}, - {0, "e"}, - {0, "foo"}, - {0, "zap"}, - {0, "zip"}, - {0, "ALPHA"}, - {0, "alpha"}, + {Score: 0, Member: "aaaa"}, + {Score: 0, Member: "b"}, + {Score: 0, Member: "c"}, + {Score: 0, Member: "d"}, + {Score: 0, Member: "e"}, + {Score: 0, Member: "foo"}, + {Score: 0, Member: "zap"}, + {Score: 0, Member: "zip"}, + {Score: 0, Member: "ALPHA"}, + {Score: 0, Member: "alpha"}, } for _, z := range zz { err := client.ZAdd("zset", z).Err() @@ -2586,12 +2787,12 @@ var _ = Describe("Commands", func() { }) It("should ZRevRange", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRevRange := client.ZRevRange("zset", 0, -1) Expect(zRevRange.Err()).NotTo(HaveOccurred()) @@ -2607,33 +2808,48 @@ var _ = Describe("Commands", func() { }) It("should ZRevRangeWithScoresMap", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) val, err := client.ZRevRangeWithScores("zset", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{3, "three"}, {2, "two"}, {1, "one"}})) + Expect(val).To(Equal([]redis.Z{{ + Score: 3, + Member: "three", + }, { + Score: 2, + Member: "two", + }, { + Score: 1, + Member: "one", + }})) val, err = client.ZRevRangeWithScores("zset", 2, 3).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{1, "one"}})) + Expect(val).To(Equal([]redis.Z{{Score: 1, Member: "one"}})) val, err = client.ZRevRangeWithScores("zset", -2, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}, {1, "one"}})) + Expect(val).To(Equal([]redis.Z{{ + Score: 2, + Member: "two", + }, { + Score: 1, + Member: "one", + }})) }) It("should ZRevRangeByScore", func() { - zadd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) vals, err := client.ZRevRangeByScore( "zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result() @@ -2652,12 +2868,12 @@ var _ = Describe("Commands", func() { }) It("should ZRevRangeByLex", func() { - zadd := client.ZAdd("zset", redis.Z{0, "a"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{0, "b"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{0, "c"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 0, Member: "a"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 0, Member: "b"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 0, Member: "c"}).Err() + Expect(err).NotTo(HaveOccurred()) vals, err := client.ZRevRangeByLex( "zset", redis.ZRangeBy{Max: "+", Min: "-"}).Result() @@ -2676,50 +2892,68 @@ var _ = Describe("Commands", func() { }) It("should ZRevRangeByScoreWithScores", func() { - zadd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) - zadd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zadd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) vals, err := client.ZRevRangeByScoreWithScores( "zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result() Expect(err).NotTo(HaveOccurred()) - Expect(vals).To(Equal([]redis.Z{{3, "three"}, {2, "two"}, {1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 3, + Member: "three", + }, { + Score: 2, + Member: "two", + }, { + Score: 1, + Member: "one", + }})) }) It("should ZRevRangeByScoreWithScoresMap", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) - val, err := client.ZRevRangeByScoreWithScores( + vals, err := client.ZRevRangeByScoreWithScores( "zset", redis.ZRangeBy{Max: "+inf", Min: "-inf"}).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{3, "three"}, {2, "two"}, {1, "one"}})) + Expect(vals).To(Equal([]redis.Z{{ + Score: 3, + Member: "three", + }, { + Score: 2, + Member: "two", + }, { + Score: 1, + Member: "one", + }})) - val, err = client.ZRevRangeByScoreWithScores( + vals, err = client.ZRevRangeByScoreWithScores( "zset", redis.ZRangeBy{Max: "2", Min: "(1"}).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{2, "two"}})) + Expect(vals).To(Equal([]redis.Z{{Score: 2, Member: "two"}})) - val, err = client.ZRevRangeByScoreWithScores( + vals, err = client.ZRevRangeByScoreWithScores( "zset", redis.ZRangeBy{Max: "(2", Min: "(1"}).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{})) + Expect(vals).To(Equal([]redis.Z{})) }) It("should ZRevRank", func() { - zAdd := client.ZAdd("zset", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zRevRank := client.ZRevRank("zset", "one") Expect(zRevRank.Err()).NotTo(HaveOccurred()) @@ -2731,7 +2965,7 @@ var _ = Describe("Commands", func() { }) It("should ZScore", func() { - zAdd := client.ZAdd("zset", redis.Z{1.001, "one"}) + zAdd := client.ZAdd("zset", redis.Z{Score: 1.001, Member: "one"}) Expect(zAdd.Err()).NotTo(HaveOccurred()) zScore := client.ZScore("zset", "one") @@ -2740,17 +2974,17 @@ var _ = Describe("Commands", func() { }) It("should ZUnionStore", func() { - zAdd := client.ZAdd("zset1", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset1", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err := client.ZAdd("zset1", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset1", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset2", redis.Z{1, "one"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset2", redis.Z{2, "two"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) - zAdd = client.ZAdd("zset2", redis.Z{3, "three"}) - Expect(zAdd.Err()).NotTo(HaveOccurred()) + err = client.ZAdd("zset2", redis.Z{Score: 1, Member: "one"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset2", redis.Z{Score: 2, Member: "two"}).Err() + Expect(err).NotTo(HaveOccurred()) + err = client.ZAdd("zset2", redis.Z{Score: 3, Member: "three"}).Err() + Expect(err).NotTo(HaveOccurred()) zUnionStore := client.ZUnionStore( "out", redis.ZStore{Weights: []float64{2, 3}}, "zset1", "zset2") @@ -2759,7 +2993,16 @@ var _ = Describe("Commands", func() { val, err := client.ZRangeWithScores("out", 0, -1).Result() Expect(err).NotTo(HaveOccurred()) - Expect(val).To(Equal([]redis.Z{{5, "one"}, {9, "three"}, {10, "two"}})) + Expect(val).To(Equal([]redis.Z{{ + Score: 5, + Member: "one", + }, { + Score: 9, + Member: "three", + }, { + Score: 10, + Member: "two", + }})) }) }) diff --git a/example_instrumentation_test.go b/example_instrumentation_test.go index 85abbd74..82f655f2 100644 --- a/example_instrumentation_test.go +++ b/example_instrumentation_test.go @@ -24,7 +24,7 @@ func Example_instrumentation() { // finished processing: } -func Example_Pipeline_instrumentation() { +func ExamplePipeline_instrumentation() { client := redis.NewClient(&redis.Options{ Addr: ":6379", })