From ea2aec86b1d62e5be70af752a6124bb3ed100586 Mon Sep 17 00:00:00 2001 From: Ivan Palladino Date: Fri, 14 Jun 2019 18:53:25 +0200 Subject: [PATCH 1/2] gopherbot: relaxed matching rule for the documentation label Documentation word is more specific than document to match issues related to Documentation. Fixes golang/go#31153 --- cmd/gopherbot/gopherbot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index 45ef7349a2..bf843f4dd8 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go @@ -1988,7 +1988,7 @@ func isDocumentationTitle(t string) bool { if strings.Contains(t, "godoc:") { // in x/tools, or the dozen places people file it as return false } - return strings.Contains(t, "document") || + return strings.Contains(t, "documentation") || strings.Contains(t, "docs ") } From 8247ae2ee44f286162465aca6c76ce0190c72259 Mon Sep 17 00:00:00 2001 From: Ivan Palladino Date: Sat, 15 Jun 2019 17:42:44 +0200 Subject: [PATCH 2/2] cmd/gopherbot: match just the whole word document When the title contains the word document then repeat the check with a regex word boundaries rule then return positive just in case of a whole word match. Updates golang/go#31153 --- cmd/gopherbot/gopherbot.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index bf843f4dd8..b9000501b7 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go @@ -19,6 +19,7 @@ import ( "net/http" "os" "path/filepath" + "regexp" "sort" "strconv" "strings" @@ -1988,8 +1989,11 @@ func isDocumentationTitle(t string) bool { if strings.Contains(t, "godoc:") { // in x/tools, or the dozen places people file it as return false } - return strings.Contains(t, "documentation") || - strings.Contains(t, "docs ") + if strings.Contains(t, "docs ") { + return true + } + return strings.Contains(t, "document") && + regexp.MustCompile(`\bdocument\b`).MatchString(t) } func isGoplsTitle(t string) bool {