]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add -modfile flag that sets go.mod file to read/write
authorJay Conrod <jayconrod@google.com>
Tue, 22 Oct 2019 15:30:20 +0000 (11:30 -0400)
committerJay Conrod <jayconrod@google.com>
Thu, 24 Oct 2019 20:15:50 +0000 (20:15 +0000)
commitc357b363cf1027afe3296e973ea6f6613cc757ad
tree089677a31fcbabaccf4e5c6172c103529a0b0975
parentc4c37547b12f113d07b987881a81c1dbc754cd66
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>
doc/go1.14.html
src/cmd/go/alldocs.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/modcmd/edit.go
src/cmd/go/internal/modcmd/init.go
src/cmd/go/internal/modcmd/mod.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/work/build.go
src/cmd/go/internal/work/init.go
src/cmd/go/main.go
src/cmd/go/testdata/script/modfile_flag.txt [new file with mode: 0644]