go/internal/gcimporter: temporarily skip the contraints package on the
unified builder
Temporary work-around to fix TryBots until the failure can be
investigated.
Updates golang/go#48595
Change-Id: Ifbc27fc4551195bd9c7427bab7a79076c6ba6392
Reviewed-on: https://go-review.googlesource.com/c/tools/+/352050
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/go/internal/gcimporter/iexport_test.go b/go/internal/gcimporter/iexport_test.go
index 5385011..e1e9d7f 100644
--- a/go/internal/gcimporter/iexport_test.go
+++ b/go/internal/gcimporter/iexport_test.go
@@ -31,6 +31,7 @@
"golang.org/x/tools/go/buildutil"
"golang.org/x/tools/go/internal/gcimporter"
"golang.org/x/tools/go/loader"
+ "golang.org/x/tools/internal/testenv"
)
func readExportFile(filename string) ([]byte, error) {
@@ -83,8 +84,15 @@
Sizes: types.SizesFor(ctxt.Compiler, ctxt.GOARCH),
},
}
+ // Temporarily skip packages that use generics on the unified builder, to fix
+ // TryBots.
+ //
+ // TODO(#48595): fix this test with GOEXPERIMENT=unified.
+ isUnified := os.Getenv("GO_BUILDER_NAME") == "linux-amd64-unified"
for _, path := range buildutil.AllPackages(conf.Build) {
- conf.Import(path)
+ if !(isUnified && testenv.UsesGenerics(path)) {
+ conf.Import(path)
+ }
}
// Create a package containing type and value errors to ensure
diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go
index 61735dc..0010ca4 100644
--- a/internal/testenv/testenv.go
+++ b/internal/testenv/testenv.go
@@ -297,3 +297,9 @@
t.Skipf("running Go version %q is version 1.%d, newer than maximum 1.%d", runtime.Version(), Go1Point(), x)
}
}
+
+// UsesGenerics reports if the standard library package stdlibPkg uses
+// generics.
+func UsesGenerics(stdlibPkg string) bool {
+ return stdlibPkg == "constraints"
+}