Skip to content

Commit 88604bc

Browse files
committed
go/packages: set GOPACKAGESDRIVER=off for all the tests
Tests that use packagestest.Export already have GOPACKAGESDRIVER=off, make sure the rest of the tests are setting it off to make sure the value of GOPACKGESDRIVER doesn't affect tests that are run locally. Fixes golang/go#33956 Change-Id: If14dce17f413f46a3d36cdf2679e992ec9147a53 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192397 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent bce6695 commit 88604bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

go/packages/packages_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ const A = 1
10251025
`)
10261026
config := &packages.Config{
10271027
Dir: tmp,
1028+
Env: append(os.Environ(), "GOPACKAGESDRIVER=off"),
10281029
Mode: packages.LoadAllSyntax,
10291030
Overlay: map[string][]byte{
10301031
filename: content,
@@ -1093,6 +1094,7 @@ go 1.11
10931094
// Run packages.Load on mod2, while passing the contents over mod1/main.go in the overlay.
10941095
config := &packages.Config{
10951096
Dir: mod2,
1097+
Env: append(os.Environ(), "GOPACKAGESDRIVER=off"),
10961098
Mode: packages.LoadImports,
10971099
Overlay: map[string][]byte{
10981100
filepath.Join(mod1, "main.go"): []byte(`package main
@@ -1757,7 +1759,7 @@ func TestRejectInvalidQueries(t *testing.T) {
17571759
queries := []string{"key=", "key=value"}
17581760
cfg := &packages.Config{
17591761
Mode: packages.LoadImports,
1760-
Env: append(os.Environ(), "GO111MODULE=off"),
1762+
Env: append(os.Environ(), "GO111MODULE=off", "GOPACKAGESDRIVER=off"),
17611763
}
17621764
for _, q := range queries {
17631765
if _, err := packages.Load(cfg, q); err == nil {
@@ -1956,7 +1958,7 @@ func testReturnErrorWhenUsingNonGoFiles(t *testing.T, exporter packagestest.Expo
19561958
"b/b.c": `package b`,
19571959
}}})
19581960
defer exported.Cleanup()
1959-
config := packages.Config{}
1961+
config := packages.Config{Env: append(os.Environ(), "GOPACKAGESDRIVER=off")}
19601962
want := "named files must be .go files"
19611963
pkgs, err := packages.Load(&config, "a/a.go", "b/b.c")
19621964
if err != nil {

0 commit comments

Comments
 (0)