From: Bryan C. Mills Date: Mon, 9 Mar 2020 19:47:53 +0000 (-0400) Subject: cmd/internal/moddeps: set GO111MODULE explicitly for moddeps_test 'go' commands X-Git-Tag: go1.15beta1~891 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=eafb4d8f8f57f52cbb6792aeff535783525186c5;p=gostls13.git cmd/internal/moddeps: set GO111MODULE explicitly for moddeps_test 'go' commands This fixes observed failures using the following steps to reproduce: go env -w GO111MODULE=off go test cmd/internal/moddeps Fixes #37749 Change-Id: I7761f0b20266ac911ad19a724ba2551beca3f267 Reviewed-on: https://go-review.googlesource.com/c/go/+/222674 Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod Reviewed-by: Michael Matloob --- diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go index d544a4d8df..b6fd92438e 100644 --- a/src/cmd/internal/moddeps/moddeps_test.go +++ b/src/cmd/internal/moddeps/moddeps_test.go @@ -47,6 +47,7 @@ func findGorootModules(t *testing.T) []gorootModule { // Use 'go list' to describe the module contained in this directory (but // not its dependencies). cmd := exec.Command(goBin, "list", "-json", "-m") + cmd.Env = append(os.Environ(), "GO111MODULE=on") cmd.Dir = dir cmd.Stderr = new(strings.Builder) out, err := cmd.Output() @@ -103,6 +104,7 @@ func TestAllDependenciesVendored(t *testing.T) { // dependencies are vendored. If any imported package is missing, // 'go list -deps' will fail when attempting to load it. cmd := exec.Command(goBin, "list", "-mod=vendor", "-deps", "./...") + cmd.Env = append(os.Environ(), "GO111MODULE=on") cmd.Dir = m.Dir cmd.Stderr = new(strings.Builder) _, err := cmd.Output() @@ -115,7 +117,8 @@ func TestAllDependenciesVendored(t *testing.T) { // There is no vendor directory, so the module must have no dependencies. // Check that the list of active modules contains only the main module. - cmd := exec.Command(goBin, "list", "-m", "all") + cmd := exec.Command(goBin, "list", "-mod=mod", "-m", "all") + cmd.Env = append(os.Environ(), "GO111MODULE=on") cmd.Dir = m.Dir cmd.Stderr = new(strings.Builder) out, err := cmd.Output()