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