@@ -5,7 +5,6 @@ package example_commands_test
55import (
66 "context"
77 "fmt"
8- "maps"
98 "slices"
109
1110 "github.com/redis/go-redis/v9"
@@ -76,12 +75,16 @@ func ExampleClient_hset() {
7675 panic (err )
7776 }
7877
79- keys := slices .Collect (maps .Keys (res6 ))
78+ keys := make ([]string , 0 , len (res6 ))
79+
80+ for key , _ := range res6 {
81+ keys = append (keys , key )
82+ }
8083
8184 slices .Sort (keys )
8285
83- for key , value := range res6 {
84- fmt .Printf ("Key: %v, value: %v\n " , key , value )
86+ for key , _ := range res6 {
87+ fmt .Printf ("Key: %v, value: %v\n " , key , res6 [ key ] )
8588 }
8689 // >>> Key: field1, value: Hello
8790 // >>> Key: field2, value: Hi
@@ -175,12 +178,16 @@ func ExampleClient_hgetall() {
175178 panic (err )
176179 }
177180
178- keys := slices .Collect (maps .Keys (hGetAllResult2 ))
181+ keys := make ([]string , 0 , len (hGetAllResult2 ))
182+
183+ for key , _ := range hGetAllResult2 {
184+ keys = append (keys , key )
185+ }
179186
180187 slices .Sort (keys )
181188
182- for key , value := range hGetAllResult2 {
183- fmt .Printf ("Key: %v, value: %v\n " , key , value )
189+ for key , _ := range hGetAllResult2 {
190+ fmt .Printf ("Key: %v, value: %v\n " , key , hGetAllResult2 [ key ] )
184191 }
185192 // >>> Key: field1, value: Hello
186193 // >>> Key: field2, value: World
0 commit comments