From 480db94d33e6088e08d628833b6c0705451d24bb Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 24 Jul 2018 10:48:14 +0300 Subject: [PATCH] Fix example --- example_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example_test.go b/example_test.go index 3d0fde0c..c3ac33fb 100644 --- a/example_test.go +++ b/example_test.go @@ -324,11 +324,17 @@ func ExamplePubSub() { pubsub := client.Subscribe("mychannel1") defer pubsub.Close() + // Wait for confirmation that subscription is created before publishing anything. + _, err := pubsub.Receive() + if err != nil { + panic(err) + } + // Go channel which receives messages. ch := pubsub.Channel() // Publish a message. - err := client.Publish("mychannel1", "hello").Err() + err = client.Publish("mychannel1", "hello").Err() if err != nil { panic(err) }