diff options
author | Jay Conrod <jayconrod@google.com> | 2019-10-22 14:45:31 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2019-10-22 20:00:03 +0000 |
commit | 8ba43eaad8263f26e16846e345389146ec234364 (patch) | |
tree | 9b4e1b44e4ed4b2014db4a1fad9ee6426b4041cc /src/cmd/go/internal/modcmd/init.go | |
parent | 88186e5e232625f9c91d639e0cb90a88c6cf1172 (diff) | |
download | go-8ba43eaad8263f26e16846e345389146ec234364.tar.gz go-8ba43eaad8263f26e16846e345389146ec234364.zip |
cmd/go: support -modcacherw in 'go mod' subcommands
The -modcacherw flag is now registered in work.AddModCommonFlags,
which is called from work.AddBuildFlags, where it was registered
before. 'go mod' subcommands register the flag by calling
work.AddModCommonFlags directly.
Also, build commands now exit with an error if -modcacherw is set
explicitly (not in GOFLAGS) in GOPATH mode.
Updates #31481
Change-Id: I461e59a51ed31b006fff4d5c57c2a866be0bbf38
Reviewed-on: https://go-review.googlesource.com/c/go/+/202563
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modcmd/init.go')
-rw-r--r-- | src/cmd/go/internal/modcmd/init.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/go/internal/modcmd/init.go b/src/cmd/go/internal/modcmd/init.go index b94453bab0..2858a46c4e 100644 --- a/src/cmd/go/internal/modcmd/init.go +++ b/src/cmd/go/internal/modcmd/init.go @@ -9,6 +9,7 @@ package modcmd import ( "cmd/go/internal/base" "cmd/go/internal/modload" + "cmd/go/internal/work" "os" "strings" ) @@ -27,6 +28,10 @@ To override this guess, supply the module path as an argument. Run: runInit, } +func init() { + work.AddModCommonFlags(cmdInit) +} + func runInit(cmd *base.Command, args []string) { modload.CmdModInit = true if len(args) > 1 { |