aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/work/build.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-10-18 16:52:12 -0400
committerBryan C. Mills <bcmills@google.com>2019-10-21 15:48:39 +0000
commit84b0e3665d9684b9957103deaa9c5984c146cdfd (patch)
tree68c1cb13d98c0b40f8dfc5dfe6fde19e92df3c9b /src/cmd/go/internal/work/build.go
parentb653c878b1ad8d1b4f8d7b04201d0cb0a4156ead (diff)
downloadgo-84b0e3665d9684b9957103deaa9c5984c146cdfd.tar.gz
go-84b0e3665d9684b9957103deaa9c5984c146cdfd.zip
cmd/go: add a flag to avoid creating unwritable directories in the module cache
This change adds the '-modcacherw' build flag, which leaves newly-created directories (but not the files!) in the module cache read-write instead of making them unwritable. Fixes #31481 Change-Id: I7c21a53dd145676627c3b51096914ce797991d99 Reviewed-on: https://go-review.googlesource.com/c/go/+/202079 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/work/build.go')
-rw-r--r--src/cmd/go/internal/work/build.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index 54b049b68f..9b74963f43 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -102,6 +102,9 @@ and test commands:
-mod mode
module download mode to use: readonly or vendor.
See 'go help modules' for more.
+ -modcacherw
+ leave newly-created directories in the module cache read-write
+ instead of making them read-only.
-pkgdir dir
install and load all packages from dir instead of the usual locations.
For example, when building with a non-standard configuration,
@@ -243,6 +246,7 @@ func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) {
cmd.Flag.StringVar(&cfg.BuildContext.InstallSuffix, "installsuffix", "", "")
cmd.Flag.Var(&load.BuildLdflags, "ldflags", "")
cmd.Flag.BoolVar(&cfg.BuildLinkshared, "linkshared", false, "")
+ cmd.Flag.BoolVar(&cfg.BuildModcacheRW, "modcacherw", false, "")
cmd.Flag.StringVar(&cfg.BuildPkgdir, "pkgdir", "", "")
cmd.Flag.BoolVar(&cfg.BuildRace, "race", false, "")
cmd.Flag.BoolVar(&cfg.BuildMSan, "msan", false, "")