Skip to content

Commit

Permalink
cmd/go: recommend 'go get' command to switch from retracted versions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jay Conrod committed Nov 20, 2020
1 parent c306fd6 commit a19c925
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cmd/go/internal/modget/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/cmd/go/testdata/script/mod_get_retract.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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$'

Expand Down

0 comments on commit a19c925

Please sign in to comment.