diff --git a/example_test.go b/example_test.go index ec8c151..291e5b4 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) }