Shorten conditions
This commit is contained in:
parent
852661578c
commit
32121799b5
|
@ -71,8 +71,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := bsq.Publish(msg)
|
if ok := bsq.Publish(msg); ok {
|
||||||
if ok {
|
|
||||||
fmt.Printf("Message successfully published to queue %q\n", msg.Queue)
|
fmt.Printf("Message successfully published to queue %q\n", msg.Queue)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Failed to publish message to queue %q\n", msg.Queue)
|
fmt.Printf("Failed to publish message to queue %q\n", msg.Queue)
|
||||||
|
@ -83,9 +82,7 @@ func main() {
|
||||||
Name: "sub",
|
Name: "sub",
|
||||||
Usage: "Subscribe for message from queue",
|
Usage: "Subscribe for message from queue",
|
||||||
Action: func(c *cli.Context) {
|
Action: func(c *cli.Context) {
|
||||||
msg := bsq.Subscribe(c.Args()...)
|
if msg := bsq.Subscribe(c.Args()...); msg != nil {
|
||||||
|
|
||||||
if msg != nil {
|
|
||||||
fmt.Println(string(msg.Body))
|
fmt.Println(string(msg.Body))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Failed to recieve message from queues %s\n", strings.Join(c.Args(), ", "))
|
fmt.Printf("Failed to recieve message from queues %s\n", strings.Join(c.Args(), ", "))
|
||||||
|
|
Loading…
Reference in New Issue