]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: set GO111MODULE=off explicitly in tests that assume GOPATH mode
authorBryan C. Mills <bcmills@google.com>
Wed, 13 Feb 2019 20:06:46 +0000 (15:06 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 19 Feb 2019 19:57:03 +0000 (19:57 +0000)
We will soon switch GO111MODULE to 'on' by default, and when that
happens these tests will otherwise break.

Updates #30228

Change-Id: I1016d429b1dfb889d1aae8bc86fb2567cf0fc56f
Reviewed-on: https://go-review.googlesource.com/c/162697
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
50 files changed:
src/cmd/go/go_test.go
src/cmd/go/testdata/script/binary_only.txt
src/cmd/go/testdata/script/build_GOTMPDIR.txt
src/cmd/go/testdata/script/build_cache_compile.txt
src/cmd/go/testdata/script/build_cache_gomips.txt
src/cmd/go/testdata/script/build_cache_link.txt
src/cmd/go/testdata/script/build_cache_output.txt
src/cmd/go/testdata/script/build_nocache.txt
src/cmd/go/testdata/script/build_relative_pkgdir.txt
src/cmd/go/testdata/script/build_relative_tmpdir.txt
src/cmd/go/testdata/script/build_runtime_gcflags.txt
src/cmd/go/testdata/script/cache_unix.txt
src/cmd/go/testdata/script/cgo_syso_issue29253.txt
src/cmd/go/testdata/script/clean_testcache.txt
src/cmd/go/testdata/script/cover_atomic_pkgall.txt
src/cmd/go/testdata/script/cover_pkgall_runtime.txt
src/cmd/go/testdata/script/cpu_profile_twice.txt
src/cmd/go/testdata/script/fileline.txt
src/cmd/go/testdata/script/gcflags_patterns.txt
src/cmd/go/testdata/script/get_brace.txt
src/cmd/go/testdata/script/get_dotfiles.txt
src/cmd/go/testdata/script/get_tilde.txt
src/cmd/go/testdata/script/get_unicode.txt
src/cmd/go/testdata/script/get_with_git_trace.txt
src/cmd/go/testdata/script/goflags.txt
src/cmd/go/testdata/script/help.txt
src/cmd/go/testdata/script/install_cleans_build.txt
src/cmd/go/testdata/script/install_cross_gobin.txt
src/cmd/go/testdata/script/install_rebuild_gopath.txt
src/cmd/go/testdata/script/install_rebuild_removed.txt
src/cmd/go/testdata/script/linkname.txt
src/cmd/go/testdata/script/list_bad_import.txt
src/cmd/go/testdata/script/list_compiled_imports.txt
src/cmd/go/testdata/script/list_find.txt
src/cmd/go/testdata/script/list_importmap.txt
src/cmd/go/testdata/script/list_std.txt
src/cmd/go/testdata/script/list_tags.txt
src/cmd/go/testdata/script/list_test_e.txt
src/cmd/go/testdata/script/list_test_imports.txt
src/cmd/go/testdata/script/mod_find.txt
src/cmd/go/testdata/script/mod_gobuild_import.txt
src/cmd/go/testdata/script/pattern_syntax_error.txt
src/cmd/go/testdata/script/run_hello.txt
src/cmd/go/testdata/script/run_wildcard.txt
src/cmd/go/testdata/script/script_wait.txt
src/cmd/go/testdata/script/test_badtest.txt
src/cmd/go/testdata/script/test_compile_binary.txt
src/cmd/go/testdata/script/test_devnull.txt
src/cmd/go/testdata/script/vendor_complex.txt
src/cmd/go/testdata/script/vet_asm.txt

index c58bc7408d0097039a76cafc3d081a838a64f283..866241bf39dcf27bcedbe1db7fbe2f44569fef2b 100644 (file)
@@ -394,6 +394,7 @@ func (tg *testgoData) setenv(name, val string) {
 func (tg *testgoData) unsetenv(name string) {
        if tg.env == nil {
                tg.env = append([]string(nil), os.Environ()...)
+               tg.env = append(tg.env, "GO111MODULE=off")
        }
        for i, v := range tg.env {
                if strings.HasPrefix(v, name+"=") {
index 397904efaa8ab0fc9ebc826d32e8001b985ffb9f..1842d8cea3e396f59f287007cb4d5554ce80e481 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # check that error for missing binary-only says where it should be
 ! go build b
 stderr pkg[\\/].*a\.a
index ea06dcc472def69ec7a68dd8bf569c827beb5f2e..da54ced524214f7321fce7a2c52836a5533256dc 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
 env GOCACHE=$WORK/gocache
 
index 7db881a2682d6f45d8ac22939c8db50224a3c6ce..04a6f9af1d0ee21b40fb8c2135941b65aa0d9f54 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Set up fresh GOCACHE.
 env GOCACHE=$WORK/gocache
 mkdir $GOCACHE
index c77acc3f2f32d10c97337cfcb72c4daba2e7c300..3218354929f48c926ce863fc01ae71dd087571a9 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Set up fresh GOCACHE.
 env GOCACHE=$WORK/gocache
 mkdir $GOCACHE
index 61e7ee46d3a78d8ff3792ab96e3f2faed4f69661..658bb8849675c49a1c9a4b468b62c855246c1a6b 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Set up fresh GOCACHE.
 env GOCACHE=$WORK/gocache
 mkdir $GOCACHE
index ee4099e5f356cb8eec818ddaf5c7496c6d19d9a8..41c84ace7ad4885d9cb682ebaec7bd9c1cfe6897 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!gc] skip
 
 # Set up fresh GOCACHE.
index 5aa46e0b77378e8c3f74c6a228bd90b73ad54b33..46e95fa89d0e23af8afc56f03f553682478bba33 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # As of Go 1.12, the module cache is required.
 
 # If none of the variables we use to locate GOCACHE are set, the cache is off
index 76098a0662ba9b6575f421d669889120a96503b6..0716bcd56a591e9c161ff04052ac75fddb4f6f8d 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Regression test for golang.org/issue/21309: accept relative -pkgdir argument.
 
 [short] skip
index 9490a285d34fcd5170382c3214931eb01094a59d..3e98a67b813e1174924678765f80336c1c1f0eea 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # If GOTMPDIR is relative, 'go build' should derive an absolute $WORK directory.
 cd $WORK
 mkdir tmp
index 767b768b82f874d17ebd27961ba975665d16f30c..5354a7393532c3e67f2e2b8df757c7b243bffd88 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Set up fresh GOCACHE.
 env GOCACHE=$WORK/gocache
 mkdir $GOCACHE
index f700ebe3ed2cfc8c5e58b707115afa71691345aa..0e07ba63823e52b12502e2ffcf3a0969ee8b207b 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Integration test for cache directory calculation (cmd/go/internal/cache).
 
 [windows] skip
index 0d18fa91d6b7fa9068c2b3b37edc0b6ea88af92a..9825d1e3e987262daf589936306822726e8aedb4 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # This test tests that we can link in-package syso files that provides symbols
 # for cgo. See issue 29253.
 [!cgo] stop
index a2d592deffdda5323cdeb4f890d2056d2ea962c3..5ac968b7d0a6fca4b8c45059e548b8e55623a3eb 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go clean -testcache
 # should work (see golang.org/issue/29757).
 cd x
index c122c05cb68930e27655d3896afe7d2ebf3096dc..c3bc67df534687b7823a4244e8b9a612e976d70e 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [short] skip
 
 go test -coverpkg=all -covermode=atomic x
index 5d169d631268e21f8bc851e82baa4644f3df8457..9927c3069070fdeed6712717bc0c222039b07e06 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Issue 23882
 
 [short] skip
index 142d5ee718dceb754630d4ae833b61f1dd7513f4..38d6439fb1717eb06abf022ec71ed6a8d9d3a0e6 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Issue 23150
 
 [short] skip
index cdc3be2df8f12bb4b1b923351fc238c3ffc9b8fa..5cb35f0dac35f92851ecc768d39e7e5aea55fb36 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # look for short, relative file:line in error message
 ! go run ../../gopath/x/y/z/err.go
 stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go:
index 40f80b7d6e971eea78426389c4d2899ed4763e0e..f2e6e2b67da8c155cef9f60893707c0313b54c5b 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!gc] skip 'using -gcflags and -ldflags'
 
 # -gcflags=-e applies to named packages, not dependencies
index be81d8f4875cc12d12624fc0939a5581a870f8f8..3449a0c2c82995fc54786f672fb2caf1f4a3b8f9 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!exec:git] skip
 
 # Set up some empty repositories.
index 1876114362690c35fded65ff212fc4ff2e005af6..38a3fac612235c67c56d268301acb4505f900e45 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!exec:git] skip
 
 # Set up a benign repository and a repository with a dotfile name.
index 08289ca4054c02aa10590ca492474d50da8e317d..6d18174acc3154dac6e8265e8a1f0473cb0ad6bd 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Paths containing windows short names should be rejected before attempting to fetch.
 ! go get example.com/longna~1.dir/thing
 stderr 'trailing tilde and digits'
index 31edcdb9f66c98710e75afeea3f1fab778216cdc..ab1b914f50659a8157bf0131265b522bc502b8d7 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!exec:git] skip
 
 # Construct a repository that imports a non-ASCII path.
index 93341a302c86cf8942af1aac30d55d982f5f584f..98854c72ad262b3d360760429415000ee2053520 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 env GIT_TRACE=1
 
 [!net] skip
index 20de325ac286b7b89ad190aff4187c08e250df98..fac6d807202285e365ff343b2b18bfd62105c5d9 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # GOFLAGS sets flags for commands
 
 env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10'
index 9f455256f72d880d558fd0c4572e6189bc06353d..e6cbc829281cbdb227a55e1e218ccbc27742a356 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go help shows overview.
 go help
 stdout 'Go is a tool'
index b8d322de629899ea638dddc9dd25ae25f6f65ad0..7f1b9174397b18a515088ca6c3560ac6b6303bd3 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # 'go install' with no arguments should clean up after go build
 cd mycmd
 go build
index 587081f1355a6a8cdde752942cbb06869a3579fc..d9ab35c2e16c8253790dea9e6cf6298ccb356321 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 cd mycmd
 go build mycmd
 
index d42b07004bf62880887ebece9e951352e4180957..14a6c8611e32d5421276b71c2a2bb975e80eb8db 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # GOPATH with p1 in d1, p2 in d2
 env GOPATH=$WORK/d1${:}$WORK/d2
 
index e7620a08caebee224c2d553610ad0482e3b57d3f..5db3778d8eb8b929997e623e8036e01f82a95500 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go command should detect package staleness as source file set changes
 go install mypkg
 ! stale mypkg
index e2ec00c6edc3d8aa4aa8cf8e9d84bf5324e138cc..11336594d3596ba8a203bdc1099d90d63bc054b1 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # check for linker name in error message about linker crash
 [!gc] skip
 ! go build -ldflags=-crash_for_testing x.go
index 3d9cac0d5f5495b0bfb8a52856a9e6f840a385c1..958c576c53c54bbbe25a20f7d87f735b43897f34 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # This test matches mod_list_bad_import, but in GOPATH mode.
 # Please keep them in sync.
 
index e6f5abb6af129a58412be09a845456076253f31b..7780b074c1053229a129f6103c15ee17a61eb6b9 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!cgo] skip
 
 # go list should report import "C"
index 63c6896e507dbbaceaf02a0e71c6a2025320bf19..aaac6585dd55f96ed1d0ee6202cacf1b7f3c56ac 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go list -find should not report imports
 
 go list -f {{.Incomplete}} x/y/z...  # should probably exit non-zero but never has
index a42dc47f2443bc8d884c54731bfe1fbf03ef4edc..52ee6028f5bd2a25dc259e24f4647c3afd39ce2a 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # gccgo does not have standard packages.
 [gccgo] skip
 
index 046bec6ac54b054e817539e6efa8d137276c937b..88a659f74332defcee3c3b11012a792a4fd90b25 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!gc] skip
 
 # listing GOROOT should only find standard packages
index c5dc99e9fbad3daafb98c2498f19127b58ac0c68..49069bd2135eae367b6f4b5f50b707c92a7c9c0b 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go list supports -tags
 go list -tags=thetag ./my...
 stdout mypkg
index f1473322c65fbaf93c4956701d032cee648c8c9d..4e36b88e859ae531dee7e0f3e70322371b83d74f 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # issue 25980: crash in go list -e -test
 go list -e -test -f '{{.Error}}' p
 stdout '^p[/\\]d_test.go:2:8: cannot find package "d" in any of:'
index 51d1ce9a69642e0bcc5e14e65483688cb90b5d3b..b2a6bc45f9ef0f55cc5996144b63b606991e1d97 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # issue 26880: list with tests has wrong variant in imports
 go list -test -f '{{.ImportPath}}:{{with .Imports}} {{join . ", "}}{{end}}' a b
 cmp stdout imports.txt
index eb7f974b3b7bbcca6baef53e8ed3bd80cbccf617..703a88e99c9a83dc020f9b328fca3437e59ebe8b 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=auto
+
 # Derive module path from import comment.
 cd $WORK/x
 exists x.go
index 932b8b66f92fe54eed912ee0c8a02f35fc1021a0..d2d1645b838edd4f45394721930411f65f878b6f 100644 (file)
@@ -7,14 +7,12 @@ env GO111MODULE=off
 ! exec $WORK/testimport.exe x/y/z/w .
 
 # GO111MODULE=auto in GOPATH/src
-env GO111MODULE=
-! exec $WORK/testimport.exe x/y/z/w .
 env GO111MODULE=auto
 ! exec $WORK/testimport.exe x/y/z/w .
 
 # GO111MODULE=auto outside GOPATH/src
 cd $GOPATH/other
-env GO111MODULE=
+env GO111MODULE=auto
 exec $WORK/testimport.exe other/x/y/z/w .
 stdout w2.go
 
@@ -22,7 +20,6 @@ stdout w2.go
 stderr 'cannot find module providing package x/y/z/w'
 
 cd z
-env GO111MODULE=auto
 exec $WORK/testimport.exe other/x/y/z/w .
 stdout w2.go
 
@@ -33,6 +30,7 @@ stdout w2.go
 
 # GO111MODULE=on in GOPATH/src
 cd $GOPATH/src
+env GO111MODULE=on
 exec $WORK/testimport.exe x/y/z/w .
 stdout w1.go
 cd w
index 8e6549b5c54e1d3a7907654b0ae84ea28b7cb355..9a1f5e52f07a168dac7d442a02f42210a463e5a5 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # patterns match directories with syntax errors
 ! go list ./...
 ! go build ./...
index 8c4c1c16833e97f7fa4226097bb731d560daa938..939b661e58f378ede7fc0735759d0628c7e7d99c 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # hello world
 go run hello.go
 stderr 'hello world'
index cd401e00e6441faef329bbd81cca97fdf06339ec..72036d1d8dbdc7469dfac3db4d9aa3a0e57ab282 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Fix for https://github.com/golang/go/issues/28696:
 # go run x/... should not panic when directory x doesn't exist.
 
index 0770b39523d5f63c857549e1bbe175418b47e5e2..3cd4ded9dd111a986a720514b2287003643ec7e3 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 [!exec:echo] skip
 [!exec:false] skip
 
index 42fcfed2fcc53a42aeed6998122fc6c7e11db04c..f5db6941a0d129e72d040fa0d2a52c9bc47518a6 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 ! go test badtest/...
 ! stdout ^ok
 stdout ^FAIL\tbadtest/badexec
index 6c01bc5729e91389266552a794f7c94b4fe47625..6562f2453ff4100ac5ebac63fa4429459bd88918 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 ! go test -c compile_binary/...
 stderr 'build comment'
 
index c414e59ba3a9c7c222950aa44db74df61dfc4f67..e7ebda33ee5b0bff6094d6f2ef41071ad8070571 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # go test -c -o NUL
 # should work (see golang.org/issue/28035).
 cd x
index 6513451df856c4eb1bcd74da1d102c9395d84ad0..9ca94e72c527491faa16b909eb13da684a7fce5c 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # smoke test for complex build configuration
 go build -o complex.exe complex
 [exec:gccgo] go build -compiler=gccgo -o complex.exe complex
index 807e2b76f589999f9670fe30464b9dd31d44f570..ea920ea866c50ea3720af2e47415a7dbf23c4a93 100644 (file)
@@ -1,3 +1,5 @@
+env GO111MODULE=off
+
 # Issue 27665. Verify that "go vet" analyzes non-Go files.
 
 env GOOS=linux