diff options
author | Duco van Amstel <duco.vanamstel@gmail.com> | 2018-12-08 16:04:10 +0000 |
---|---|---|
committer | Wim <wim@42.be> | 2018-12-08 17:04:10 +0100 |
commit | a2754f15fc2bc2eede94e2e41712f9f0585f2426 (patch) | |
tree | 52894a30d0ca7a06b90a7b2266fde41a5e8404c5 /bridge/sshchat/sshchat.go | |
parent | b6d81f34ba7ee88e7a18a27cf4e0aeebaaf82c79 (diff) | |
download | matterbridge-msglm-a2754f15fc2bc2eede94e2e41712f9f0585f2426.tar.gz matterbridge-msglm-a2754f15fc2bc2eede94e2e41712f9f0585f2426.tar.bz2 matterbridge-msglm-a2754f15fc2bc2eede94e2e41712f9f0585f2426.zip |
Enable errcheck linter (#646)
Diffstat (limited to 'bridge/sshchat/sshchat.go')
-rw-r--r-- | bridge/sshchat/sshchat.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go index 827c81de..555759bf 100644 --- a/bridge/sshchat/sshchat.go +++ b/bridge/sshchat/sshchat.go @@ -30,9 +30,10 @@ func (b *Bsshchat) Connect() error { b.r = bufio.NewScanner(r) b.w = w b.r.Scan() - w.Write([]byte("/theme mono\r\n")) - b.handleSSHChat() - return nil + if _, handleErr := w.Write([]byte("/theme mono\r\n")); handleErr != nil { + return handleErr + } + return b.handleSSHChat() }) }() if err != nil { @@ -59,7 +60,9 @@ func (b *Bsshchat) Send(msg config.Message) (string, error) { b.Log.Debugf("=> Receiving %#v", msg) if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { - b.w.Write([]byte(rmsg.Username + rmsg.Text + "\r\n")) + if _, err := b.w.Write([]byte(rmsg.Username + rmsg.Text + "\r\n")); err != nil { + b.Log.Errorf("Could not send extra message: %#v", err) + } } if len(msg.Extra["file"]) > 0 { for _, f := range msg.Extra["file"] { @@ -73,13 +76,15 @@ func (b *Bsshchat) Send(msg config.Message) (string, error) { msg.Text = fi.Comment + ": " + fi.URL } } - b.w.Write([]byte(msg.Username + msg.Text)) + if _, err := b.w.Write([]byte(msg.Username + msg.Text)); err != nil { + b.Log.Errorf("Could not send file message: %#v", err) + } } return "", nil } } - b.w.Write([]byte(msg.Username + msg.Text + "\r\n")) - return "", nil + _, err := b.w.Write([]byte(msg.Username + msg.Text + "\r\n")) + return "", err } /* |