Skip to content

Commit 92427f6

Browse files
committed
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 <[email protected]>
1 parent be58d06 commit 92427f6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

repos/repos.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type Repo struct {
3939
// https://golang.org/pkg/#subrepo.
4040
// It should be plain text. Hostnames may be auto-linkified.
4141
WebsiteDesc string
42+
43+
// usePkgGoDev controls whether the repo has opted-in to use
44+
// pkg.go.dev for displaying documentation for Go packages.
45+
usePkgGoDev bool
4246
}
4347

4448
// ByGerritProject maps from a Gerrit project name ("go", "net", etc)
@@ -73,7 +77,7 @@ func init() {
7377
x("net", desc("additional networking packages"))
7478
x("oauth2")
7579
x("perf", desc("packages and tools for performance measurement, storage, and analysis"))
76-
x("pkgsite", desc("home of the pkg.go.dev website"), noBuildAndNoDash)
80+
x("pkgsite", desc("home of the pkg.go.dev website"), usePkgGoDev(), noBuildAndNoDash)
7781
x("playground", noDash)
7882
x("review", desc("a tool for working with Gerrit code reviews"))
7983
x("scratch", noDash)
@@ -119,6 +123,7 @@ func coordinatorCanBuild(r *Repo) { r.CoordinatorCanBuild = true }
119123
func importPath(v string) modifyRepo { return func(r *Repo) { r.ImportPath = v } }
120124

121125
func desc(v string) modifyRepo { return func(r *Repo) { r.WebsiteDesc = v } }
126+
func usePkgGoDev() modifyRepo { return func(r *Repo) { r.usePkgGoDev = true } }
122127

123128
// addMirrored adds a repo that's on Gerrit and mirrored to GitHub.
124129
func addMirrored(proj string, opts ...modifyRepo) {
@@ -191,3 +196,7 @@ func (r *Repo) ShowOnDashboard() bool { return r.showOnDashboard }
191196
// at or is mirrored to. It returns the empty string if this repo has no
192197
// GitHub presence.
193198
func (r *Repo) GitHubRepo() string { return r.gitHubRepo }
199+
200+
// UsePkgGoDev reports whether the repo has opted-in to use
201+
// pkg.go.dev for displaying documentation for Go packages.
202+
func (r *Repo) UsePkgGoDev() bool { return r.usePkgGoDev }

0 commit comments

Comments
 (0)