5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 07:00:27 +00:00

Make scopelint happy

This commit is contained in:
Wim 2018-11-08 22:29:34 +01:00
parent b2a07aba3a
commit 78401214b0
6 changed files with 6 additions and 0 deletions

View File

@ -389,6 +389,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
if msg.Extra != nil { if msg.Extra != nil {
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
rmsg := rmsg // scopelint
iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl")) 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 := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text, Props: make(map[string]interface{})}
matterMessage.Props["matterbridge_"+b.uuid] = true matterMessage.Props["matterbridge_"+b.uuid] = true

View File

@ -49,6 +49,7 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) {
b.Log.Debugf("=> Receiving %#v", msg) b.Log.Debugf("=> Receiving %#v", msg)
if msg.Extra != nil { if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
rmsg := rmsg // scopelint
iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl")) iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text} matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text}
b.mh.Send(matterMessage) b.mh.Send(matterMessage)

View File

@ -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. // If we have files attached, download them (in memory) and put a pointer to it in msg.Extra.
for _, f := range ev.Files { for _, f := range ev.Files {
f := f
err := b.handleDownloadFile(rmsg, &f) err := b.handleDownloadFile(rmsg, &f)
if err != nil { if err != nil {
b.Log.Errorf("Could not download incoming file: %#v", err) b.Log.Errorf("Could not download incoming file: %#v", err)

View File

@ -219,6 +219,7 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) {
if msg.Extra != nil { if msg.Extra != nil {
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
rmsg := rmsg // scopelint
iconURL := config.GetIconURL(&rmsg, b.GetString(iconURLConfig)) iconURL := config.GetIconURL(&rmsg, b.GetString(iconURLConfig))
matterMessage := matterhook.OMessage{ matterMessage := matterhook.OMessage{
IconURL: iconURL, IconURL: iconURL,

View File

@ -128,6 +128,7 @@ func (gw *Gateway) AddConfig(cfg *config.Gateway) error {
gw.MyConfig = cfg gw.MyConfig = cfg
gw.mapChannels() gw.mapChannels()
for _, br := range append(gw.MyConfig.In, append(gw.MyConfig.InOut, gw.MyConfig.Out...)...) { for _, br := range append(gw.MyConfig.In, append(gw.MyConfig.InOut, gw.MyConfig.Out...)...) {
br := br //scopelint
err := gw.AddBridge(&br) err := gw.AddBridge(&br)
if err != nil { if err != nil {
return err return err

View File

@ -70,6 +70,7 @@ func (r *Router) getBridge(account string) *bridge.Bridge {
func (r *Router) handleReceive() { func (r *Router) handleReceive() {
for msg := range r.Message { for msg := range r.Message {
msg := msg // scopelint
if msg.Event == config.EVENT_FAILURE { if msg.Event == config.EVENT_FAILURE {
Loop: Loop:
for _, gw := range r.Gateways { for _, gw := range r.Gateways {