use more idiomatic for loop in ExamplePubSub

This commit is contained in:
Issac Trotts 2018-10-03 16:36:21 -07:00 committed by GitHub
parent 2e77539901
commit e99b0688d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -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)
} }