diff options
author | Jay Conrod <jayconrod@google.com> | 2021-03-31 14:47:59 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2021-04-09 18:20:48 +0000 |
commit | 814c5ff13810e800aeb67fd0371e21984d4d2c64 (patch) | |
tree | b11301ba1ae9dacbae011f3e0e1d2fb024025ded /src/cmd/go/internal/list/list.go | |
parent | 952187af12485eb665ae122f6d0bdb36e4a11ed7 (diff) | |
download | go-814c5ff13810e800aeb67fd0371e21984d4d2c64.tar.gz go-814c5ff13810e800aeb67fd0371e21984d4d2c64.zip |
cmd/go: support module deprecation
A module is deprecated if its author adds a comment containing a
paragraph starting with "Deprecated:" to its go.mod file. The comment
must appear immediately before the "module" directive or as a suffix
on the same line. The deprecation message runs from just after
"Deprecated:" to the end of the paragraph. This is implemented in
CL 301089.
'go list -m -u' loads deprecation messages from the latest version of
each module, not considering retractions (i.e., deprecations and
retractions are loaded from the same version). By default, deprecated
modules are printed with a "(deprecated)" suffix. The full deprecation
message is available in the -f and -json output.
'go get' prints deprecation warnings for modules named on the command
line. It also prints warnings for modules needed to build packages
named on the command line if those modules are direct dependencies of
the main module.
For #40357
Change-Id: Id81fb2b24710681b025becd6cd74f746f4378e78
Reviewed-on: https://go-review.googlesource.com/c/go/+/306334
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/internal/list/list.go')
-rw-r--r-- | src/cmd/go/internal/list/list.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/list/list.go b/src/cmd/go/internal/list/list.go index 898a39ea24..9b78a64d5f 100644 --- a/src/cmd/go/internal/list/list.go +++ b/src/cmd/go/internal/list/list.go @@ -348,7 +348,7 @@ func runList(ctx context.Context, cmd *base.Command, args []string) { if *listM { *listFmt = "{{.String}}" if *listVersions { - *listFmt = `{{.Path}}{{range .Versions}} {{.}}{{end}}` + *listFmt = `{{.Path}}{{range .Versions}} {{.}}{{end}}{{if .Deprecated}} (deprecated){{end}}` } } else { *listFmt = "{{.ImportPath}}" @@ -453,7 +453,7 @@ func runList(ctx context.Context, cmd *base.Command, args []string) { var mode modload.ListMode if *listU { - mode |= modload.ListU | modload.ListRetracted + mode |= modload.ListU | modload.ListRetracted | modload.ListDeprecated } if *listRetracted { mode |= modload.ListRetracted |