aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/internal/modload/init.go8
-rw-r--r--src/cmd/go/testdata/script/mod_enabled.txt4
-rw-r--r--src/go/build/build.go4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 7a62436e35..9596368f00 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -120,9 +120,9 @@ func Init() {
switch env {
default:
base.Fatalf("go: unknown environment setting GO111MODULE=%s", env)
- case "auto", "":
+ case "auto":
mustUseModules = ForceUseModules
- case "on":
+ case "on", "":
mustUseModules = true
case "off":
if ForceUseModules {
@@ -257,9 +257,9 @@ func WillBeEnabled() bool {
// exits, so it can't call this function directly.
env := cfg.Getenv("GO111MODULE")
switch env {
- case "on":
+ case "on", "":
return true
- case "auto", "":
+ case "auto":
break
default:
return false
diff --git a/src/cmd/go/testdata/script/mod_enabled.txt b/src/cmd/go/testdata/script/mod_enabled.txt
index 10fa103fad..39f1ece8cb 100644
--- a/src/cmd/go/testdata/script/mod_enabled.txt
+++ b/src/cmd/go/testdata/script/mod_enabled.txt
@@ -25,7 +25,7 @@ cd $GOPATH/foo/bar/baz
go env GOMOD
stdout foo[/\\]go.mod
-# GO111MODULE unset should be equivalent to auto.
+# GO111MODULE unset should be equivalent to on.
env GO111MODULE=
cd $GOPATH/src/x/y/z
@@ -34,7 +34,7 @@ stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod
cd $GOPATH/src/x/y
go env GOMOD
-! stdout .
+stdout 'NUL|/dev/null'
# GO111MODULE=on should trigger everywhere
env GO111MODULE=on
diff --git a/src/go/build/build.go b/src/go/build/build.go
index 39bc3591a7..6b75aad9cf 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -1072,9 +1072,9 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode)
}
}
- // Unless GO111MODULE=on, look to see if there is a go.mod.
+ // If GO111MODULE=auto, look to see if there is a go.mod.
// Since go1.13, it doesn't matter if we're inside GOPATH.
- if go111Module != "on" {
+ if go111Module == "auto" {
var (
parent string
err error