From b6d63f64323f41a67140c36014b84a32da95a9f2 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 19 Mar 2016 11:38:18 -0400 Subject: [PATCH] Fix a few minor govet issues --- plugins/counter.go | 2 +- plugins/factoid.go | 10 +++++----- slack/slack.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/counter.go b/plugins/counter.go index 5c49f35..f1915ce 100644 --- a/plugins/counter.go +++ b/plugins/counter.go @@ -84,7 +84,7 @@ func (p *CounterPlugin) Message(message bot.Message) bool { } resp = fmt.Sprintf("%s %s: %d", resp, it.Item, it.Count) if count > 20 { - fmt.Sprintf("%s, and a few others", resp) + resp = fmt.Sprintf("%s, and a few others", resp) break } } diff --git a/plugins/factoid.go b/plugins/factoid.go index dbf5da0..1d66f86 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -229,18 +229,18 @@ func NewFactoidPlugin(botInst *bot.Bot) *FactoidPlugin { for _, channel := range botInst.Config.Channels { go p.factTimer(channel) - go func() { + go func(ch) { // Some random time to start up time.Sleep(time.Duration(15) * time.Second) if ok, fact := p.findTrigger(p.Bot.Config.StartupFact); ok { p.sayFact(bot.Message{ - Channel: channel, + Channel: ch, Body: "speed test", // BUG: This is defined in the config too Command: true, Action: false, }, *fact) } - }() + }(channel) } return p @@ -373,7 +373,7 @@ func (p *FactoidPlugin) tellThemWhatThatWas(message bot.Message) bool { msg = "Nope." } else { msg = fmt.Sprintf("That was (#%d) '%s <%s> %s'", - fact.id, fact.fact, fact.verb, fact.tidbit) + fact.id.Int64, fact.fact, fact.verb, fact.tidbit) } p.Bot.SendMessage(message.Channel, msg) return true @@ -435,7 +435,7 @@ func (p *FactoidPlugin) forgetLastFact(message bot.Message) bool { if err != nil { log.Println("Error removing fact: ", p.LastFact, err) } - fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id, p.LastFact.fact, + fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id.Int64, p.LastFact.fact, p.LastFact.verb, p.LastFact.tidbit) p.Bot.SendAction(message.Channel, "hits himself over the head with a skillet") p.LastFact = nil diff --git a/slack/slack.go b/slack/slack.go index 29440d8..eb05d0a 100644 --- a/slack/slack.go +++ b/slack/slack.go @@ -1,4 +1,4 @@ -// Package to connect to slack service +// Package slack connects to slack service package slack import ( @@ -113,7 +113,7 @@ func (s *Slack) Serve() { for { msg, err := s.receiveMessage() if err != nil { - log.Printf("Slack API error: ", err) + log.Fatalf("Slack API error: %s", err) } switch msg.Type { case "message": @@ -134,7 +134,7 @@ func (s *Slack) Serve() { // Convert a slackMessage to a bot.Message func (s *Slack) buildMessage(msg slackMessage) bot.Message { - log.Println("DEBUG: msg: %%#v", msg) + log.Printf("DEBUG: msg: %#v", msg) text := html.UnescapeString(msg.Text) isCmd, text := bot.IsCmd(s.config, text)