summaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modinfo
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-07-24 15:01:22 -0400
committerRuss Cox <rsc@golang.org>2018-07-28 01:14:56 +0000
commit0cb6b55f43dabdfac8c5afab6d00c9cd65eaadb4 (patch)
tree245b85939256af50eee85a1cb61a03322e16e731 /src/cmd/go/internal/modinfo
parent011b6ff8d7b121a0d9c6a7dc899591d89dc9712e (diff)
downloadgo-git-0cb6b55f43dabdfac8c5afab6d00c9cd65eaadb4.tar.gz
cmd/go: add go list -m -f {{.GoMod}} to show path to go.mod file
"go env GOMOD" gives this for the main module already but it's useful to be able to query other modules. Using {{.Dir}} does not work if the go.mod was auto-synthesized. Change-Id: If4844571e9e429b541de0d40c36ff4c5743b2031 Reviewed-on: https://go-review.googlesource.com/125656 Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modinfo')
-rw-r--r--src/cmd/go/internal/modinfo/info.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/internal/modinfo/info.go b/src/cmd/go/internal/modinfo/info.go
index 3920546c94..761b526b93 100644
--- a/src/cmd/go/internal/modinfo/info.go
+++ b/src/cmd/go/internal/modinfo/info.go
@@ -19,6 +19,7 @@ type ModulePublic struct {
Main bool `json:",omitempty"` // is this the main module?
Indirect bool `json:",omitempty"` // module is only indirectly needed by main module
Dir string `json:",omitempty"` // directory holding local copy of files, if any
+ GoMod string `json:",omitempty"` // path to go.mod file describing module, if any
Error *ModuleError `json:",omitempty"` // error loading module
}