1
0
mirror of https://github.com/golang/go synced 2024-11-26 04:17:59 -07:00

cmd/go: recommend 'go get' command to switch from retracted versions

This CL restores a message unintentionally removed in CL 270858.

For #24031

Change-Id: I957c5c59e624df98e72dfff351298bfc5bf9a9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/272066
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Jay Conrod 2020-11-20 11:18:15 -05:00
parent c306fd6d0b
commit a19c925eda
2 changed files with 10 additions and 0 deletions

View File

@ -1567,11 +1567,20 @@ func (r *resolver) checkPackagesAndRetractions(ctx context.Context, pkgPatterns
})
}
<-r.work.Idle()
var retractPath string
for _, r := range retractions {
if r.err != nil {
fmt.Fprintf(os.Stderr, "go: warning: %v\n", r.err)
if retractPath == "" {
retractPath = r.m.Path
} else {
retractPath = "<module>"
}
}
}
if retractPath != "" {
fmt.Fprintf(os.Stderr, "go: run 'go get %s@latest' to switch to the latest unretracted version\n", retractPath)
}
}
// reportChanges logs version changes to os.Stderr.

View File

@ -11,6 +11,7 @@ cp go.mod.orig go.mod
go mod edit -require example.com/retract/self/prev@v1.9.0
go get -d example.com/retract/self/prev
stderr '^go: warning: example.com/retract/self/prev@v1.9.0: retracted by module author: self$'
stderr '^go: run ''go get example.com/retract/self/prev@latest'' to switch to the latest unretracted version$'
go list -m example.com/retract/self/prev
stdout '^example.com/retract/self/prev v1.9.0$'