aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-12-09 14:29:29 -0500
committerJay Conrod <jayconrod@google.com>2019-12-09 21:50:59 +0000
commit3a3093d5c7e1fb557d7b598a758f4925db4b0f13 (patch)
tree50246d0f51000117844e7c7f37e93713926d9987
parent7d24e9581a5a5958848e2ae8171fb33a1650c6b8 (diff)
downloadgo-3a3093d5c7e1fb557d7b598a758f4925db4b0f13.tar.gz
go-3a3093d5c7e1fb557d7b598a758f4925db4b0f13.zip
cmd/go: document 'go env GOMOD' outside modules
In documentation for 'go env GOMOD', note that the path will be os.DevNull in module-aware mode when no go.mod file is present. Fixes #36052 Change-Id: I30ced1df02ccefe1970bd856190e79d6f0384375 Reviewed-on: https://go-review.googlesource.com/c/go/+/210577 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
-rw-r--r--src/cmd/go/alldocs.go6
-rw-r--r--src/cmd/go/internal/help/helpdoc.go6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 87c82b16de..54e7a8b5b3 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1726,8 +1726,10 @@
// GOHOSTOS
// The operating system (GOOS) of the Go toolchain binaries.
// GOMOD
-// The absolute path to the go.mod of the main module,
-// or the empty string if not using modules.
+// The absolute path to the go.mod of the main module.
+// If module-aware mode is enabled, but there is no go.mod, GOMOD will be
+// os.DevNull ("/dev/null" on Unix-like systems, "NUL" on Windows).
+// If module-aware mode is disabled, GOMOD will be the empty string.
// GOTOOLDIR
// The directory where the go tools (compile, cover, doc, etc...) are installed.
//
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index ac16312aaf..6a843f459a 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -621,8 +621,10 @@ Additional information available from 'go env' but not read from the environment
GOHOSTOS
The operating system (GOOS) of the Go toolchain binaries.
GOMOD
- The absolute path to the go.mod of the main module,
- or the empty string if not using modules.
+ The absolute path to the go.mod of the main module.
+ If module-aware mode is enabled, but there is no go.mod, GOMOD will be
+ os.DevNull ("/dev/null" on Unix-like systems, "NUL" on Windows).
+ If module-aware mode is disabled, GOMOD will be the empty string.
GOTOOLDIR
The directory where the go tools (compile, cover, doc, etc...) are installed.
`,