mirror of https://github.com/golang/go.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 <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
576fa69277
commit
eafb4d8f8f
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue