summaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/mssola/user_agent/bot.go
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/mssola/user_agent/bot.go')
-rw-r--r--Godeps/_workspace/src/github.com/mssola/user_agent/bot.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/Godeps/_workspace/src/github.com/mssola/user_agent/bot.go b/Godeps/_workspace/src/github.com/mssola/user_agent/bot.go
index cc993d8fe..df0b6ccda 100644
--- a/Godeps/_workspace/src/github.com/mssola/user_agent/bot.go
+++ b/Godeps/_workspace/src/github.com/mssola/user_agent/bot.go
@@ -9,6 +9,8 @@ import (
"strings"
)
+var botFromSiteRegexp = regexp.MustCompile("http://.+\\.\\w+")
+
// Get the name of the bot from the website that may be in the given comment. If
// there is no website in the comment, then an empty string is returned.
func getFromSite(comment []string) string {
@@ -23,8 +25,7 @@ func getFromSite(comment []string) string {
}
// Pick the site.
- re := regexp.MustCompile("http://.+\\.\\w+")
- results := re.FindStringSubmatch(comment[idx])
+ results := botFromSiteRegexp.FindStringSubmatch(comment[idx])
if len(results) == 1 {
// If it's a simple comment, just return the name of the site.
if idx == 0 {