mirror of
https://github.com/redis/go-redis.git
synced 2025-04-19 07:22:17 +03:00
Merge pull request #876 from ijt/patch-1
use more idiomatic for loop in ExamplePubSub
This commit is contained in:
commit
ae8fdc56f3
@ -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…
x
Reference in New Issue
Block a user