aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2025-02-14 14:29:40 -0500
committerJonathan Amsterdam <jba@google.com>2025-02-14 12:50:47 -0800
commitdd488e5da97a2d18430760c4558bf0b6be1a4bfd (patch)
treea6a6e99a5c820d4c2150507fdd7c59c00e6ce834
parentb866f8692660b0e79ffdfe2f1530de1f4ab4a109 (diff)
downloadgo-x-pkgsite-dd488e5da97a2d18430760c4558bf0b6be1a4bfd.tar.xz
internal/fetch: look at files with tag goexperiment.synctest
If a file has the goexperiment.synctest tag, the worker will include it when constructing documentation. This was done for testing/synctest (clearly). We should gather a list of all GOEXPERIMENT tags that affect stdlib files, and include them as well. For golang/go#71488. Change-Id: Ibed834ebfcff529a58cd54efcacf4fe70941c5b0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/649319 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r--internal/fetch/load.go1
-rw-r--r--internal/fetch/load_test.go22
2 files changed, 23 insertions, 0 deletions
diff --git a/internal/fetch/load.go b/internal/fetch/load.go
index b88f7a04..d890c2d6 100644
--- a/internal/fetch/load.go
+++ b/internal/fetch/load.go
@@ -418,6 +418,7 @@ func matchingFiles(goos, goarch string, allFiles map[string][]byte) (matchedFile
GOARCH: goarch,
CgoEnabled: true,
Compiler: build.Default.Compiler,
+ BuildTags: []string{"goexperiment.synctest"},
ReleaseTags: build.Default.ReleaseTags,
JoinPath: path.Join,
diff --git a/internal/fetch/load_test.go b/internal/fetch/load_test.go
index 7503ef2b..a6b442c3 100644
--- a/internal/fetch/load_test.go
+++ b/internal/fetch/load_test.go
@@ -21,6 +21,12 @@ func TestMatchingFiles(t *testing.T) {
// Package js only works with wasm.
package js
type Value int`
+ synctestBody := `
+ //go:build goexperiment.synctest
+
+ package synctest
+ var X int
+ `
plainContents := map[string]string{
"README.md": "THIS IS A README",
@@ -33,6 +39,12 @@ func TestMatchingFiles(t *testing.T) {
"LICENSE.md": testhelper.MITLicense,
"js.go": jsGoBody,
}
+
+ synctestContents := map[string]string{
+ "plain.go": plainGoBody,
+ "st.go": synctestBody,
+ }
+
for _, test := range []struct {
name string
goos, goarch string
@@ -73,6 +85,16 @@ func TestMatchingFiles(t *testing.T) {
"js.go": []byte(jsGoBody),
},
},
+ {
+ name: "synctest",
+ goos: "linux",
+ goarch: "amd64",
+ contents: synctestContents,
+ want: map[string][]byte{
+ "plain.go": []byte(plainGoBody),
+ "st.go": []byte(synctestBody),
+ },
+ },
} {
t.Run(test.name, func(t *testing.T) {
files := map[string][]byte{}