x/vulndb: update vulnreport lint for std lib links
Update lint checks to allow a golang-nuts announcement (some older
reports use this), and update error message for context links to
be more precise.
Change-Id: I40976495038dcfb52fb7144c2d740270f75cdf1e
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/408276
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Run-TryBot: Tatiana Bradley <tatiana@golang.org>
Auto-Submit: Tatiana Bradley <tatiana@golang.org>
diff --git a/internal/report/lint.go b/internal/report/lint.go
index ee8c05d..17a64c4 100644
--- a/internal/report/lint.go
+++ b/internal/report/lint.go
@@ -238,7 +238,7 @@
prRegex = regexp.MustCompile(`https://go.dev/cl/\d+`)
commitRegex = regexp.MustCompile(`https://go.googlesource.com/go/\+/([^/]+)`)
issueRegex = regexp.MustCompile(`https://go.dev/issue/\d+`)
- announceRegex = regexp.MustCompile(`https://groups.google.com/g/(golang-announce|golang-dev)/c/([^/]+)`)
+ announceRegex = regexp.MustCompile(`https://groups.google.com/g/golang-(announce|dev|nuts)/c/([^/]+)`)
)
func isFirstPartyGoLink(l string) bool {
@@ -264,7 +264,7 @@
}
if !isFirstPartyGoLink(c) {
- addIssue(fmt.Sprintf("links.context should contain only first-party links, remove %q", c))
+ addIssue(fmt.Sprintf("links.context should contain only PR, commit, issue and announcement links, remove or fix %q", c))
}
}
if !hasIssueLink {
diff --git a/internal/report/lint_test.go b/internal/report/lint_test.go
index d440f71..5437b75 100644
--- a/internal/report/lint_test.go
+++ b/internal/report/lint_test.go
@@ -275,7 +275,7 @@
"links.commit should contain a commit link",
"links.context should contain an issue link",
"links.context should contain an announcement link",
- "links.context should contain only first-party links",
+ "links.context should contain only PR, commit, issue and announcement links",
// Unfixed link errors.
`"https://github.com/golang/go/commit/12345" should be "https://go.googlesource.com/+/12345"`,
`"https://github.com/golang/go/issues/12345" should be "https://go.dev/issue/12345"`,