From eb392a7e6af9c1042be903bae06e7d15c44e4077 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 29 Apr 2019 14:06:09 +0800 Subject: [PATCH] err --- main.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index bff2673..507bb09 100644 --- a/main.go +++ b/main.go @@ -107,13 +107,19 @@ func ListenCW(c *tdlib.Client) { return false } - conn, _ := amqp.Dial("amqp://shoopea:UmDd5g4WRa2MzqOHsG2T@localhost:5672/chatwars/" + strconv.FormatInt(ownUserID64, 10)) + conn, err := amqp.Dial("amqp://shoopea:UmDd5g4WRa2MzqOHsG2T@localhost:5672/chatwars/" + strconv.FormatInt(ownUserID64, 10)) + if err != nil { + log.Fatal(err) + } defer conn.Close() - ch, _ := conn.Channel() + ch, err := conn.Channel() + if err != nil { + log.Fatal(err) + } defer ch.Close() - q, _ := ch.QueueDeclare( + q, err := ch.QueueDeclare( "msg", // name false, // durable false, // delete when unused @@ -121,6 +127,9 @@ func ListenCW(c *tdlib.Client) { false, // no-wait nil, // arguments ) + if err != nil { + log.Fatal(err) + } receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100) for newMsg := range receiver.Chan {