From 399789811ecab11f7dfb775f83d063b20167bb1d Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 8 Nov 2018 00:46:34 +0100 Subject: Make gocritic linter happy --- bridge/discord/discord.go | 2 +- bridge/helper/helper.go | 2 +- bridge/irc/irc.go | 5 ++--- bridge/matrix/matrix.go | 4 ++-- bridge/telegram/telegram.go | 6 +++--- gateway/gateway.go | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 0549187f..94a09186 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -234,7 +234,7 @@ func (b *Bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdat // only when message is actually edited if m.Message.EditedTimestamp != "" { b.Log.Debugf("Sending edit message") - m.Content = m.Content + b.GetString("EditSuffix") + m.Content += b.GetString("EditSuffix") b.messageCreate(s, (*discordgo.MessageCreate)(m)) } } diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index bfa7d827..dab2bb47 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -44,7 +44,7 @@ func SplitStringLength(input string, length int) string { a := []rune(input) str := "" for i, r := range a { - str = str + string(r) + str += string(r) if i > 0 && (i+1)%length == 0 { str += "\n" } diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 25f6beec..0702575b 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -63,8 +63,7 @@ func New(cfg *bridge.Config) bridge.Bridger { } func (b *Birc) Command(msg *config.Message) string { - switch msg.Text { - case "!users": + if msg.Text == "!users" { b.i.Handlers.Add(girc.RPL_NAMREPLY, b.storeNames) b.i.Handlers.Add(girc.RPL_ENDOFNAMES, b.endNames) b.i.Cmd.SendRaw("NAMES " + msg.Channel) @@ -237,7 +236,7 @@ func (b *Birc) Send(msg config.Message) (string, error) { } if len(b.Local) < b.MessageQueue { if len(b.Local) == b.MessageQueue-1 { - text = text + " " + text += " " } b.Local <- config.Message{Text: text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} } else { diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index 18bc5572..aaf19326 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -234,11 +234,11 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content map[string]in if msgtype == "m.image" { mext, _ := mime.ExtensionsByType(mtype) if len(mext) > 0 { - name = name + mext[0] + name += mext[0] } } else { // just a default .png extension if we don't have mime info - name = name + ".png" + name += ".png" } } diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 93cc82f6..43d68edc 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -303,7 +303,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa urlPart := strings.Split(url, "/") name = urlPart[len(urlPart)-1] if !strings.HasSuffix(name, ".webp") { - name = name + ".webp" + name += ".webp" } text = " " + url } @@ -338,7 +338,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa name = urlPart[len(urlPart)-1] text = " " + url if !strings.HasSuffix(name, ".ogg") { - name = name + ".ogg" + name += ".ogg" } } if message.Audio != nil { @@ -356,7 +356,7 @@ func (b *Btelegram) handleDownload(message *tgbotapi.Message, rmsg *config.Messa // use the URL instead of native upload if b.GetBool("UseInsecureURL") { b.Log.Debugf("Setting message text to :%s", text) - rmsg.Text = rmsg.Text + text + rmsg.Text += text return nil } // if we have a file attached, download it (in memory) and put a pointer to it in msg.Extra diff --git a/gateway/gateway.go b/gateway/gateway.go index e699251f..d4c84650 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -481,7 +481,7 @@ func (gw *Gateway) handleFiles(msg *config.Message) { ext := filepath.Ext(fi.Name) fi.Name = fi.Name[0 : len(fi.Name)-len(ext)] fi.Name = reg.ReplaceAllString(fi.Name, "_") - fi.Name = fi.Name + ext + fi.Name += ext sha1sum := fmt.Sprintf("%x", sha1.Sum(*fi.Data))[:8] -- cgit v1.2.3