mirror of
https://github.com/redis/go-redis.git
synced 2025-04-16 09:23:06 +03:00
use more idiomatic for loop in ExamplePubSub
This commit is contained in:
parent
2e77539901
commit
e99b0688d6
@ -343,11 +343,7 @@ func ExamplePubSub() {
|
||||
})
|
||||
|
||||
// Consume messages.
|
||||
for {
|
||||
msg, ok := <-ch
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
for msg := range ch {
|
||||
fmt.Println(msg.Channel, msg.Payload)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user