go/doc/comment/std.go has a list of top-level package prefixes in
the standard library. This list can vary depending on goexperiment,
but the file is static. E.g.
GOEXPERIMENT=arenas go test -run=TestStd go/doc/comment
would fail.
Don't include experimental packages, as they are not (yet)
generally available. We could have a per-experiment list of
package prefixes. But given that experimental packages are not
intended to be used widely (yet), it is probably not worth the
complexity.
Change-Id: Ib5bc060297cbae29c01fee458aaaa29600b81e98
Reviewed-on: https://go-review.googlesource.com/c/go/+/723840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
package comment
var stdPkgs = []string{"
-go list std | grep -v / | sort | sed 's/.*/"&",/'
+GOEXPERIMENT=none go list std | grep -v / | sort | sed 's/.*/"&",/'
echo "}"
) | gofmt >std.go.tmp && mv std.go.tmp std.go
)
func TestStd(t *testing.T) {
- out, err := testenv.Command(t, testenv.GoToolPath(t), "list", "std").CombinedOutput()
+ cmd := testenv.Command(t, testenv.GoToolPath(t), "list", "std")
+ cmd.Env = append(cmd.Environ(), "GOEXPERIMENT=none")
+ out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("%v\n%s", err, out)
}