From 32121799b5b400b811d98a02699664f6680e03d7 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 24 Sep 2014 15:35:55 +0400 Subject: [PATCH] Shorten conditions --- cli/main.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cli/main.go b/cli/main.go index 440636a..3a38255 100644 --- a/cli/main.go +++ b/cli/main.go @@ -71,8 +71,7 @@ func main() { return } - ok := bsq.Publish(msg) - if ok { + if ok := bsq.Publish(msg); ok { fmt.Printf("Message successfully published to queue %q\n", msg.Queue) } else { fmt.Printf("Failed to publish message to queue %q\n", msg.Queue) @@ -83,9 +82,7 @@ func main() { Name: "sub", Usage: "Subscribe for message from queue", Action: func(c *cli.Context) { - msg := bsq.Subscribe(c.Args()...) - - if msg != nil { + if msg := bsq.Subscribe(c.Args()...); msg != nil { fmt.Println(string(msg.Body)) } else { fmt.Printf("Failed to recieve message from queues %s\n", strings.Join(c.Args(), ", "))