diff --git a/example_test.go b/example_test.go index ec8c1513..291e5b45 100644 --- a/example_test.go +++ b/example_test.go @@ -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) }