aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/cfg/cfg.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-10-22 11:30:20 -0400
committerJay Conrod <jayconrod@google.com>2019-10-24 20:15:50 +0000
commitc357b363cf1027afe3296e973ea6f6613cc757ad (patch)
tree089677a31fcbabaccf4e5c6172c103529a0b0975 /src/cmd/go/internal/cfg/cfg.go
parentc4c37547b12f113d07b987881a81c1dbc754cd66 (diff)
downloadgo-c357b363cf1027afe3296e973ea6f6613cc757ad.tar.gz
go-c357b363cf1027afe3296e973ea6f6613cc757ad.zip
cmd/go: add -modfile flag that sets go.mod file to read/write
This change adds the -modfile flag to module aware build commands and to 'go mod' subcommands. -modfile may be set to a path to an alternate go.mod file to be read and written. A real go.mod file must still exist and is used to set the module root directory. However, it is not opened. When -modfile is set, the effective location of the go.sum file is also changed to the -modfile with the ".mod" suffix trimmed (if present) and ".sum" added. Updates #34506 Change-Id: I2d1e044e18af55505a4f24bbff09b73bb9c908b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/202564 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/cfg/cfg.go')
-rw-r--r--src/cmd/go/internal/cfg/cfg.go3
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 36b2348888..b5d6ddca17 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -44,7 +44,8 @@ var (
BuildWork bool // -work flag
BuildX bool // -x flag
- ModCacheRW bool // -modcacherw flag
+ ModCacheRW bool // -modcacherw flag
+ ModFile string // -modfile flag
CmdName string // "build", "install", "list", "mod tidy", etc.