Skip to content

Commit dd488e5

Browse files
committed
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 <[email protected]> Reviewed-by: Damien Neil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent b866f86 commit dd488e5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

internal/fetch/load.go

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ func matchingFiles(goos, goarch string, allFiles map[string][]byte) (matchedFile
418418
GOARCH: goarch,
419419
CgoEnabled: true,
420420
Compiler: build.Default.Compiler,
421+
BuildTags: []string{"goexperiment.synctest"},
421422
ReleaseTags: build.Default.ReleaseTags,
422423

423424
JoinPath: path.Join,

internal/fetch/load_test.go

+22
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ func TestMatchingFiles(t *testing.T) {
2121
// Package js only works with wasm.
2222
package js
2323
type Value int`
24+
synctestBody := `
25+
//go:build goexperiment.synctest
26+
27+
package synctest
28+
var X int
29+
`
2430

2531
plainContents := map[string]string{
2632
"README.md": "THIS IS A README",
@@ -33,6 +39,12 @@ func TestMatchingFiles(t *testing.T) {
3339
"LICENSE.md": testhelper.MITLicense,
3440
"js.go": jsGoBody,
3541
}
42+
43+
synctestContents := map[string]string{
44+
"plain.go": plainGoBody,
45+
"st.go": synctestBody,
46+
}
47+
3648
for _, test := range []struct {
3749
name string
3850
goos, goarch string
@@ -73,6 +85,16 @@ func TestMatchingFiles(t *testing.T) {
7385
"js.go": []byte(jsGoBody),
7486
},
7587
},
88+
{
89+
name: "synctest",
90+
goos: "linux",
91+
goarch: "amd64",
92+
contents: synctestContents,
93+
want: map[string][]byte{
94+
"plain.go": []byte(plainGoBody),
95+
"st.go": []byte(synctestBody),
96+
},
97+
},
7698
} {
7799
t.Run(test.name, func(t *testing.T) {
78100
files := map[string][]byte{}

0 commit comments

Comments
 (0)