From 2744f27e5e9a66f1c26ce230dac13ad06b126cc9 Mon Sep 17 00:00:00 2001 From: Krzysztof Madejski Date: Thu, 14 Feb 2019 13:40:20 +0100 Subject: [PATCH] golint --- bridge/whatsapp/helpers.go | 10 ++++------ bridge/whatsapp/whatsapp.go | 6 ++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bridge/whatsapp/helpers.go b/bridge/whatsapp/helpers.go index 946fa28b..5268ba3e 100644 --- a/bridge/whatsapp/helpers.go +++ b/bridge/whatsapp/helpers.go @@ -67,13 +67,11 @@ func (b *Bwhatsapp) getSenderName(senderJid string) string { if sender, exists := b.users[senderJid]; exists { if sender.Name != "" { return sender.Name - - } else { - // if user is not in phone contacts - // it is the most obvious scenario unless you sync your phone contacts with some remote updated source - // users can change it in their WhatsApp settings -> profile -> click on Avatar - return sender.Notify } + // if user is not in phone contacts + // it is the most obvious scenario unless you sync your phone contacts with some remote updated source + // users can change it in their WhatsApp settings -> profile -> click on Avatar + return sender.Notify } return "" } diff --git a/bridge/whatsapp/whatsapp.go b/bridge/whatsapp/whatsapp.go index e61c7dd0..6705937c 100644 --- a/bridge/whatsapp/whatsapp.go +++ b/bridge/whatsapp/whatsapp.go @@ -262,7 +262,7 @@ func (b *Bwhatsapp) Send(msg config.Message) (string, error) { if msg.ID != "" { b.Log.Debugf("updating message with id %s", msg.ID) - msg.Text = msg.Text + " (edited)" + msg.Text += " (edited)" // TODO handle edit as a message reply with updated text } @@ -289,7 +289,9 @@ func (b *Bwhatsapp) Send(msg config.Message) (string, error) { // create message ID // TODO follow and act if https://github.com/Rhymen/go-whatsapp/issues/101 implemented bytes := make([]byte, 10) - rand.Read(bytes) + if _, err := rand.Read(bytes); err != nil { + b.Log.Warn(err.Error()) + } text.Info.Id = strings.ToUpper(hex.EncodeToString(bytes)) err := b.conn.Send(text)