4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 21:19:22 +00:00

Fix golint linter issues and enable it in CI (#593)

This commit is contained in:
Duco van Amstel
2018-11-15 19:43:43 +00:00
committed by Wim
parent c89085bf44
commit ce21ba1545
24 changed files with 147 additions and 145 deletions

View File

@ -82,7 +82,7 @@ func GetSubLines(message string, maxLineLength int) []string {
func HandleExtra(msg *config.Message, general *config.Protocol) []config.Message {
extra := msg.Extra
rmsg := []config.Message{}
for _, f := range extra[config.EVENT_FILE_FAILURE_SIZE] {
for _, f := range extra[config.EventFileFailureSize] {
fi := f.(config.FileInfo)
text := fmt.Sprintf("file %s too big to download (%#v > allowed size: %#v)", fi.Name, fi.Size, general.MediaDownloadSize)
rmsg = append(rmsg, config.Message{Text: text, Username: "<system> ", Channel: msg.Channel, Account: msg.Account})
@ -113,7 +113,7 @@ func HandleDownloadSize(flog *log.Entry, msg *config.Message, name string, size
}
flog.Debugf("Trying to download %#v with size %#v", name, size)
if int(size) > general.MediaDownloadSize {
msg.Event = config.EVENT_FILE_FAILURE_SIZE
msg.Event = config.EventFileFailureSize
msg.Extra[msg.Event] = append(msg.Extra[msg.Event], config.FileInfo{Name: name, Comment: msg.Text, Size: size})
return fmt.Errorf("File %#v to large to download (%#v). MediaDownloadSize is %#v", name, size, general.MediaDownloadSize)
}
@ -123,7 +123,7 @@ func HandleDownloadSize(flog *log.Entry, msg *config.Message, name string, size
func HandleDownloadData(flog *log.Entry, msg *config.Message, name, comment, url string, data *[]byte, general *config.Protocol) {
var avatar bool
flog.Debugf("Download OK %#v %#v", name, len(*data))
if msg.Event == config.EVENT_AVATAR_DOWNLOAD {
if msg.Event == config.EventAvatarDownload {
avatar = true
}
msg.Extra["file"] = append(msg.Extra["file"], config.FileInfo{Name: name, Data: data, URL: url, Comment: comment, Avatar: avatar})