From 78401214b0b5d26fd3f0d10139061edce35e56c1 Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 8 Nov 2018 22:29:34 +0100 Subject: [PATCH] Make scopelint happy --- bridge/mattermost/mattermost.go | 1 + bridge/rocketchat/rocketchat.go | 1 + bridge/slack/handlers.go | 1 + bridge/slack/slack.go | 1 + gateway/gateway.go | 1 + gateway/router.go | 1 + 6 files changed, 6 insertions(+) diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 5e04923e..55a4e853 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -389,6 +389,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) { if msg.Extra != nil { // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE for _, rmsg := range helper.HandleExtra(&msg, b.General) { + rmsg := rmsg // scopelint iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl")) matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text, Props: make(map[string]interface{})} matterMessage.Props["matterbridge_"+b.uuid] = true diff --git a/bridge/rocketchat/rocketchat.go b/bridge/rocketchat/rocketchat.go index c3afa46e..9062c1b9 100644 --- a/bridge/rocketchat/rocketchat.go +++ b/bridge/rocketchat/rocketchat.go @@ -49,6 +49,7 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) { b.Log.Debugf("=> Receiving %#v", msg) if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { + rmsg := rmsg // scopelint iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl")) matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text} b.mh.Send(matterMessage) diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index e3a10bcd..61f572fa 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -229,6 +229,7 @@ func (b *Bslack) handleAttachments(ev *slack.MessageEvent, rmsg *config.Message) // If we have files attached, download them (in memory) and put a pointer to it in msg.Extra. for _, f := range ev.Files { + f := f err := b.handleDownloadFile(rmsg, &f) if err != nil { b.Log.Errorf("Could not download incoming file: %#v", err) diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 814aeeac..fd8e3791 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -219,6 +219,7 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) { if msg.Extra != nil { // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE for _, rmsg := range helper.HandleExtra(&msg, b.General) { + rmsg := rmsg // scopelint iconURL := config.GetIconURL(&rmsg, b.GetString(iconURLConfig)) matterMessage := matterhook.OMessage{ IconURL: iconURL, diff --git a/gateway/gateway.go b/gateway/gateway.go index 34cdd7fe..73072fae 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -128,6 +128,7 @@ func (gw *Gateway) AddConfig(cfg *config.Gateway) error { gw.MyConfig = cfg gw.mapChannels() for _, br := range append(gw.MyConfig.In, append(gw.MyConfig.InOut, gw.MyConfig.Out...)...) { + br := br //scopelint err := gw.AddBridge(&br) if err != nil { return err diff --git a/gateway/router.go b/gateway/router.go index 3a45de36..1ea3f940 100644 --- a/gateway/router.go +++ b/gateway/router.go @@ -70,6 +70,7 @@ func (r *Router) getBridge(account string) *bridge.Bridge { func (r *Router) handleReceive() { for msg := range r.Message { + msg := msg // scopelint if msg.Event == config.EVENT_FAILURE { Loop: for _, gw := range r.Gateways {