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+"=") {
+env GO111MODULE=off
+
# check that error for missing binary-only says where it should be
! go build b
stderr pkg[\\/].*a\.a
+env GO111MODULE=off
+
# Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
env GOCACHE=$WORK/gocache
+env GO111MODULE=off
+
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
+env GO111MODULE=off
+
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
+env GO111MODULE=off
+
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
+env GO111MODULE=off
+
[!gc] skip
# Set up fresh GOCACHE.
+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
+env GO111MODULE=off
+
# Regression test for golang.org/issue/21309: accept relative -pkgdir argument.
[short] skip
+env GO111MODULE=off
+
# If GOTMPDIR is relative, 'go build' should derive an absolute $WORK directory.
cd $WORK
mkdir tmp
+env GO111MODULE=off
+
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
+env GO111MODULE=off
+
# Integration test for cache directory calculation (cmd/go/internal/cache).
[windows] skip
+env GO111MODULE=off
+
# This test tests that we can link in-package syso files that provides symbols
# for cgo. See issue 29253.
[!cgo] stop
+env GO111MODULE=off
+
# go clean -testcache
# should work (see golang.org/issue/29757).
cd x
+env GO111MODULE=off
+
[short] skip
go test -coverpkg=all -covermode=atomic x
+env GO111MODULE=off
+
# Issue 23882
[short] skip
+env GO111MODULE=off
+
# Issue 23150
[short] skip
+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:
+env GO111MODULE=off
+
[!gc] skip 'using -gcflags and -ldflags'
# -gcflags=-e applies to named packages, not dependencies
+env GO111MODULE=off
+
[!exec:git] skip
# Set up some empty repositories.
+env GO111MODULE=off
+
[!exec:git] skip
# Set up a benign repository and a repository with a dotfile name.
+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'
+env GO111MODULE=off
+
[!exec:git] skip
# Construct a repository that imports a non-ASCII path.
+env GO111MODULE=off
+
env GIT_TRACE=1
[!net] skip
+env GO111MODULE=off
+
# GOFLAGS sets flags for commands
env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10'
+env GO111MODULE=off
+
# go help shows overview.
go help
stdout 'Go is a tool'
+env GO111MODULE=off
+
# 'go install' with no arguments should clean up after go build
cd mycmd
go build
+env GO111MODULE=off
+
cd mycmd
go build mycmd
+env GO111MODULE=off
+
# GOPATH with p1 in d1, p2 in d2
env GOPATH=$WORK/d1${:}$WORK/d2
+env GO111MODULE=off
+
# go command should detect package staleness as source file set changes
go install mypkg
! stale mypkg
+env GO111MODULE=off
+
# check for linker name in error message about linker crash
[!gc] skip
! go build -ldflags=-crash_for_testing x.go
+env GO111MODULE=off
+
# This test matches mod_list_bad_import, but in GOPATH mode.
# Please keep them in sync.
+env GO111MODULE=off
+
[!cgo] skip
# go list should report import "C"
+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
+env GO111MODULE=off
+
# gccgo does not have standard packages.
[gccgo] skip
+env GO111MODULE=off
+
[!gc] skip
# listing GOROOT should only find standard packages
+env GO111MODULE=off
+
# go list supports -tags
go list -tags=thetag ./my...
stdout mypkg
+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:'
+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
+env GO111MODULE=auto
+
# Derive module path from import comment.
cd $WORK/x
exists x.go
! 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
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
# GO111MODULE=on in GOPATH/src
cd $GOPATH/src
+env GO111MODULE=on
exec $WORK/testimport.exe x/y/z/w .
stdout w1.go
cd w
+env GO111MODULE=off
+
# patterns match directories with syntax errors
! go list ./...
! go build ./...
+env GO111MODULE=off
+
# hello world
go run hello.go
stderr 'hello world'
+env GO111MODULE=off
+
# Fix for https://github.com/golang/go/issues/28696:
# go run x/... should not panic when directory x doesn't exist.
+env GO111MODULE=off
+
[!exec:echo] skip
[!exec:false] skip
+env GO111MODULE=off
+
! go test badtest/...
! stdout ^ok
stdout ^FAIL\tbadtest/badexec
+env GO111MODULE=off
+
! go test -c compile_binary/...
stderr 'build comment'
+env GO111MODULE=off
+
# go test -c -o NUL
# should work (see golang.org/issue/28035).
cd x
+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
+env GO111MODULE=off
+
# Issue 27665. Verify that "go vet" analyzes non-Go files.
env GOOS=linux