summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-11-08 00:46:34 +0100
committerWim <wim@42.be>2018-11-08 00:46:34 +0100
commit399789811ecab11f7dfb775f83d063b20167bb1d (patch)
tree771636eeeec33a66be1def907cc27f25edf10506
parent8d117cb0a48b4b7d137d1900cf0160755bfb1b65 (diff)
downloadmatterbridge-msglm-399789811ecab11f7dfb775f83d063b20167bb1d.tar.gz
matterbridge-msglm-399789811ecab11f7dfb775f83d063b20167bb1d.tar.bz2
matterbridge-msglm-399789811ecab11f7dfb775f83d063b20167bb1d.zip
Make gocritic linter happy
-rw-r--r--bridge/discord/discord.go2
-rw-r--r--bridge/helper/helper.go2
-rw-r--r--bridge/irc/irc.go5
-rw-r--r--bridge/matrix/matrix.go4
-rw-r--r--bridge/telegram/telegram.go6
-rw-r--r--gateway/gateway.go2
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 + " <message clipped>"
+ text += " <message clipped>"
}
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]