Skip to content

Commit 2ce643d

Browse files
author
Bryan C. Mills
committed
cmd/go: document GO111MODULE=auto behavior for Go 1.13
Fixes #31857 Change-Id: Ic4afe1262d863112db97794edc1ade20f6926d64 Reviewed-on: https://go-review.googlesource.com/c/go/+/180197 Reviewed-by: Jay Conrod <[email protected]>
1 parent 98100c5 commit 2ce643d

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

src/cmd/go/alldocs.go

+13-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/modload/help.go

+13-10
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,26 @@ which source files are used in a given build.
2121
2222
Module support
2323
24-
Go 1.13 includes official support for Go modules,
25-
including a module-aware 'go get' command.
26-
Module-aware mode is active by default.
24+
Go 1.13 includes support for Go modules. Module-aware mode is active by default
25+
whenever a go.mod file is found in, or in a parent of, the current directory.
26+
27+
The quickest way to take advantage of module support is to check out your
28+
repository, create a go.mod file (described in the next section) there, and run
29+
go commands from within that file tree.
2730
2831
For more fine-grained control, Go 1.13 continues to respect
2932
a temporary environment variable, GO111MODULE, which can be set to one
30-
of three string values: off, auto, or on (the default).
31-
If GO111MODULE=on or is unset, then the go command requires the use of
32-
modules, never consulting GOPATH. We refer to this as the command
33+
of three string values: off, on, or auto (the default).
34+
If GO111MODULE=on, then the go command requires the use of modules,
35+
never consulting GOPATH. We refer to this as the command
3336
being module-aware or running in "module-aware mode".
34-
If GO111MODULE=auto, then the go command enables or disables module
35-
support based on the current directory. Module support is enabled only
36-
when the current directory is outside GOPATH/src and itself contains a
37-
go.mod file or is below a directory containing a go.mod file.
3837
If GO111MODULE=off, then the go command never uses
3938
module support. Instead it looks in vendor directories and GOPATH
4039
to find dependencies; we now refer to this as "GOPATH mode."
40+
If GO111MODULE=auto or is unset, then the go command enables or disables
41+
module support based on the current directory.
42+
Module support is enabled only when the current directory contains a
43+
go.mod file or is below a directory containing a go.mod file.
4144
4245
In module-aware mode, GOPATH no longer defines the meaning of imports
4346
during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod)

0 commit comments

Comments
 (0)