aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modcmd/why.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2020-09-09 16:35:56 -0400
committerJay Conrod <jayconrod@google.com>2020-09-11 14:22:17 +0000
commit6e3df749b1058ecfaf5f6601f6f8678c0971da8e (patch)
tree100ee42a33775207098a2e8e70f12cd1bc976bed /src/cmd/go/internal/modcmd/why.go
parentb22af9b407dc29d1a733976484904ad0ab168466 (diff)
downloadgo-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/modcmd/why.go')
-rw-r--r--src/cmd/go/internal/modcmd/why.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modcmd/why.go b/src/cmd/go/internal/modcmd/why.go
index 30b15fc153..8454fdfec6 100644
--- a/src/cmd/go/internal/modcmd/why.go
+++ b/src/cmd/go/internal/modcmd/why.go
@@ -11,7 +11,6 @@ import (
"cmd/go/internal/base"
"cmd/go/internal/modload"
- "cmd/go/internal/work"
"golang.org/x/mod/module"
)
@@ -58,7 +57,7 @@ var (
func init() {
cmdWhy.Run = runWhy // break init cycle
- work.AddModCommonFlags(cmdWhy)
+ base.AddModCommonFlags(&cmdWhy.Flag)
}
func runWhy(ctx context.Context, cmd *base.Command, args []string) {