diff options
author | Jay Conrod <jayconrod@google.com> | 2020-04-15 14:42:15 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2020-08-26 21:17:01 +0000 |
commit | eb3e27ac1a9346c7c2669ba2b863811607eddeae (patch) | |
tree | 767051299d2f74722b242fecca14c96751697da1 /src/cmd/go/internal/modcmd/why.go | |
parent | 0bbd386e8bbdf419077d708d3671245fc0f50f0c (diff) | |
download | go-eb3e27ac1a9346c7c2669ba2b863811607eddeae.tar.gz go-eb3e27ac1a9346c7c2669ba2b863811607eddeae.zip |
cmd/go: add -retracted flag to 'go list'
The -retracted flag causes 'go list' to load information about
retracted module module versions.
When -retracted is used with -f or -json, the Retracted field is set
to a string containing the reason for the retraction on retracted
module versions. The string is based on comments on the retract
directive. This field is also populated when the -u flag is used.
When -retracted is used with -versions, retracted versions are shown.
Normally, they are omitted.
For #24031
Change-Id: Ic13d516eddffb1b8404e21034f78cecc9896d1b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/228382
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modcmd/why.go')
-rw-r--r-- | src/cmd/go/internal/modcmd/why.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modcmd/why.go b/src/cmd/go/internal/modcmd/why.go index da33fff89e..b16887d318 100644 --- a/src/cmd/go/internal/modcmd/why.go +++ b/src/cmd/go/internal/modcmd/why.go @@ -69,12 +69,13 @@ func runWhy(ctx context.Context, cmd *base.Command, args []string) { if *whyM { listU := false listVersions := false + listRetractions := false for _, arg := range args { if strings.Contains(arg, "@") { base.Fatalf("go mod why: module query not allowed") } } - mods := modload.ListModules(ctx, args, listU, listVersions) + mods := modload.ListModules(ctx, args, listU, listVersions, listRetractions) byModule := make(map[module.Version][]string) for _, path := range loadALL(ctx) { m := modload.PackageModule(path) |