dmitri.shuralyov.com/go/prefixtitle/...

add support for "golang.org/dl/..." issues

The golang.org/dl repo is a special case because it doesn't include
the "x" element like other golang.org/x repos. Handle it specially.
dmitshur committed 3 months ago commit 500817462677553a6769e268d66193c36b423cd6
parse.go
@@ -27,10 +27,11 @@ import (
 //
 // 	"",    "import/path: issue title"    -> ["import/path"],            "issue title"
 // 	"",    "proposal: path: issue title" -> ["path"],                   "issue title"  # Proposal.
 // 	"",    "Proposal: path: issue title" -> ["path"],                   "issue title"  # Proposal.
 // 	"",    "x/path: issue title"         -> ["golang.org/x/path"],      "issue title"  # "x/..." refers to "golang.org/x/...".
+// 	"",    "dl/path: issue title"        -> ["golang.org/dl/path"],     "issue title"  # "dl/..." refers to "golang.org/dl/...".
 // 	"",    "path1, path2: issue title"   -> ["path1", "path2"],         "issue title"  # Multiple comma-separated paths.
 // 	"mod", "import/path: issue title"    -> ["mod/import/path"],        "issue title"
 // 	"mod", "path1, path2: issue title"   -> ["mod/path1", "mod/path2"], "issue title"  # Multiple comma-separated paths.
 //
 // If there's no path prefix (preceded by ": "), prefixedTitle is returned unmodified:
@@ -51,11 +52,14 @@ func ParseIssue(module, prefixedTitle string) (paths []string, title string) {
 		return []string{path.Join(module, strings.TrimSpace(prefix))}, title
 	}
 	paths = strings.Split(prefix, ",")
 	for i := range paths {
 		paths[i] = path.Join(module, strings.TrimSpace(paths[i]))
-		if strings.HasPrefix(paths[i], "x/") || paths[i] == "x" { // Map "x/..." to "golang.org/x/...".
+		switch {
+		case strings.HasPrefix(paths[i], "x/") || paths[i] == "x": // Map "x/..." to "golang.org/x/...".
+			paths[i] = "golang.org/" + paths[i]
+		case strings.HasPrefix(paths[i], "dl/") || paths[i] == "dl": // Map "dl/..." to "golang.org/dl/...".
 			paths[i] = "golang.org/" + paths[i]
 		}
 	}
 	return paths, title
 }
parse_test.go
@@ -33,10 +33,18 @@ func TestParseIssue(t *testing.T) {
 		},
 		{ // "x" refers to "golang.org/x".
 			in:        "x: issue title",
 			wantPaths: []string{"golang.org/x"}, wantTitle: "issue title",
 		},
+		{ // "dl/..." refers to "golang.org/dl/...".
+			in:        "dl/path: issue title",
+			wantPaths: []string{"golang.org/dl/path"}, wantTitle: "issue title",
+		},
+		{ // "dl" refers to "golang.org/dl".
+			in:        "dl: issue title",
+			wantPaths: []string{"golang.org/dl"}, wantTitle: "issue title",
+		},
 		{ // Multiple comma-separated paths.
 			in:        "path1, path2: issue title",
 			wantPaths: []string{"path1", "path2"}, wantTitle: "issue title",
 		},
 		{ // No path prefix.