repos: add API for opting-in to use pkg.go.dev for documentation

The golang.org/x/pkgsite repository is the first one that needs it.

For golang/go#39150.
For golang/go#36747.
For golang/go#36106.

Change-Id: I7fa38cbe7d5d92012bb00f9c4587f60d06a94199
Reviewed-on: https://go-review.googlesource.com/c/build/+/234677
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/repos/repos.go b/repos/repos.go
index 16f9f60..8c94455 100644
--- a/repos/repos.go
+++ b/repos/repos.go
@@ -39,6 +39,10 @@
 	// https://golang.org/pkg/#subrepo.
 	// It should be plain text. Hostnames may be auto-linkified.
 	WebsiteDesc string
+
+	// usePkgGoDev controls whether the repo has opted-in to use
+	// pkg.go.dev for displaying documentation for Go packages.
+	usePkgGoDev bool
 }
 
 // ByGerritProject maps from a Gerrit project name ("go", "net", etc)
@@ -73,7 +77,7 @@
 	x("net", desc("additional networking packages"))
 	x("oauth2")
 	x("perf", desc("packages and tools for performance measurement, storage, and analysis"))
-	x("pkgsite", desc("home of the pkg.go.dev website"), noBuildAndNoDash)
+	x("pkgsite", desc("home of the pkg.go.dev website"), usePkgGoDev(), noBuildAndNoDash)
 	x("playground", noDash)
 	x("review", desc("a tool for working with Gerrit code reviews"))
 	x("scratch", noDash)
@@ -119,6 +123,7 @@
 func importPath(v string) modifyRepo { return func(r *Repo) { r.ImportPath = v } }
 
 func desc(v string) modifyRepo { return func(r *Repo) { r.WebsiteDesc = v } }
+func usePkgGoDev() modifyRepo  { return func(r *Repo) { r.usePkgGoDev = true } }
 
 // addMirrored adds a repo that's on Gerrit and mirrored to GitHub.
 func addMirrored(proj string, opts ...modifyRepo) {
@@ -191,3 +196,7 @@
 // at or is mirrored to. It returns the empty string if this repo has no
 // GitHub presence.
 func (r *Repo) GitHubRepo() string { return r.gitHubRepo }
+
+// UsePkgGoDev reports whether the repo has opted-in to use
+// pkg.go.dev for displaying documentation for Go packages.
+func (r *Repo) UsePkgGoDev() bool { return r.usePkgGoDev }