diff options
author | Jay Conrod <jayconrod@google.com> | 2020-09-09 16:35:56 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2020-09-11 14:22:17 +0000 |
commit | 6e3df749b1058ecfaf5f6601f6f8678c0971da8e (patch) | |
tree | 100ee42a33775207098a2e8e70f12cd1bc976bed /src/cmd/go/internal/cfg/cfg.go | |
parent | b22af9b407dc29d1a733976484904ad0ab168466 (diff) | |
download | go-6e3df749b1058ecfaf5f6601f6f8678c0971da8e.tar.gz go-6e3df749b1058ecfaf5f6601f6f8678c0971da8e.zip |
cmd/go: refactor -mod flag parsing
Keep track of whether the -mod flag was set explicitly. When
-mod=readonly is the default, we'll want to adjust our error messages
if it's set explicitly.
Also, register the -mod, -modcacherw, and -modfile flags in functions
in internal/base instead of internal/work. 'go mod' commands that
don't load packages shouldn't depend on internal/work.
For #40728
Change-Id: I272aea9e19908ba37e151baac4ea8630e90f241f
Reviewed-on: https://go-review.googlesource.com/c/go/+/253744
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/cfg/cfg.go')
-rw-r--r-- | src/cmd/go/internal/cfg/cfg.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go index f9bbcd9180..f874b880a6 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -27,7 +27,8 @@ var ( BuildBuildmode string // -buildmode flag BuildContext = defaultContext() BuildMod string // -mod flag - BuildModReason string // reason -mod flag is set, if set by default + BuildModExplicit bool // whether -mod was set explicitly + BuildModReason string // reason -mod was set, if set by default BuildI bool // -i flag BuildLinkshared bool // -linkshared flag BuildMSan bool // -msan flag |