From e99b0688d63bce86e514c4327c4be46e5aa05708 Mon Sep 17 00:00:00 2001 From: Issac Trotts Date: Wed, 3 Oct 2018 16:36:21 -0700 Subject: [PATCH] use more idiomatic for loop in ExamplePubSub --- example_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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) }