Direct gvisor.dev/issues to the same place as gvisor.dev/issue.

Also let the Github bug reviver detect both in TODOs.

PiperOrigin-RevId: 338785089
This commit is contained in:
Dean Deng
2020-10-23 19:29:26 -07:00
committed by gVisor bot
parent d99406cbd8
commit 039fc0fa3d
3 changed files with 27 additions and 5 deletions
+16 -5
View File
@@ -121,13 +121,24 @@ func (b *GitHubBugger) Activate(todo *Todo) (bool, error) {
return true, nil
}
// parseIssueNo parses the issue number out of the issue url.
func parseIssueNo(url string) (int, error) {
const prefix = "gvisor.dev/issue/"
var issuePrefixes = []string{
"gvisor.dev/issue/",
"gvisor.dev/issues/",
}
// parseIssueNo parses the issue number out of the issue url.
//
// 0 is returned if url does not correspond to an issue.
func parseIssueNo(url string) (int, error) {
// First check if I can handle the TODO.
idStr := strings.TrimPrefix(url, prefix)
if len(url) == len(idStr) {
var idStr string
for _, p := range issuePrefixes {
if str := strings.TrimPrefix(url, p); len(str) < len(url) {
idStr = str
break
}
}
if len(idStr) == 0 {
return 0, nil
}
+9
View File
@@ -32,6 +32,15 @@ func TestProcessLine(t *testing.T) {
},
},
},
{
line: "// TODO(foobar.com/issues/123): comment, bla. blabla.",
want: &Todo{
Issue: "foobar.com/issues/123",
Locations: []Location{
{Comment: "comment, bla. blabla."},
},
},
},
{
line: "// FIXME(b/123): internal bug",
want: &Todo{