-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: in 'go list -m', print effective go.mod file
When the -modfile flag is in use (either explicitly or from GOFLAGS), 'go list -m' will now print the effective go.mod file for the main module in the GoMod field in -f or -json output. Fixes #36220 Updates #34506 Change-Id: I89c2ee40f20e07854bb37c6e4e13eeea0cce7b0d Reviewed-on: https://go-review.googlesource.com/c/go/+/212100 Run-TryBot: Jay Conrod <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
- Loading branch information
Jay Conrod
committed
Dec 19, 2019
1 parent
a197c7b
commit 0f834bb
Showing
4 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,15 @@ cp go.sum go.sum.orig | |
go mod init example.com/m | ||
grep example.com/m go.alt.mod | ||
|
||
# 'go env GOMOD' should print the path to the real file. | ||
# 'go env' does not recognize the '-modfile' flag. | ||
go env GOMOD | ||
stdout '^\$WORK[/\\]gopath[/\\]src[/\\]go.mod$' | ||
|
||
# 'go list -m' should print the effective go.mod file as GoMod though. | ||
go list -m -f '{{.GoMod}}' | ||
stdout '^go.alt.mod$' | ||
|
||
# go mod edit should operate on the alternate file | ||
go mod edit -require rsc.io/[email protected] | ||
grep rsc.io/quote go.alt.mod | ||
|