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>
diff --git a/internal/fetch/load.go b/internal/fetch/load.go
index b88f7a0..d890c2d 100644
--- a/internal/fetch/load.go
+++ b/internal/fetch/load.go
@@ -418,6 +418,7 @@
 		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 7503ef2..a6b442c 100644
--- a/internal/fetch/load_test.go
+++ b/internal/fetch/load_test.go
@@ -21,6 +21,12 @@
 		// 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 @@
 		"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 @@
 				"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{}