From 3a3093d5c7e1fb557d7b598a758f4925db4b0f13 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Mon, 9 Dec 2019 14:29:29 -0500 Subject: [PATCH] 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 Reviewed-by: Bryan C. Mills --- src/cmd/go/alldocs.go | 6 ++++-- src/cmd/go/internal/help/helpdoc.go | 6 ++++-- 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. `, -- 2.50.0