-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: cmd/go: warn when go get updates a replaced package #66269
Comments
Better yet, the output could suggest the command: go mod edit -replace. Similar to how git sometimes suggest what you might want to do next. I prefer not to have to lookup in the docs for such things. |
@janisz What do you suggest happens when a user runs go get all or another pattern that matches multiple packges? Would you want to print an error message for each replaced package? That could get very cluttered. |
That's a good point! I think we should print this info for every replaced package that is updated. So you can see that package version has changed in go.mod but it has no effect because it's replaced. |
I think it's reasonable that if there was a replacement such as |
Proposal Details
Introduction:
The current behavior of go
get -u PKG
does not adequately handle packages that have been replaced in thego.mod
file. This proposal aims to improve the user experience by providing clearer information when a replaced package is encountered during thego get -u
operation.Details:
When a user runs
go get -u PKG
and PKG has a replacement specified in thego.mod
file, the go get command currently does not download the latest version of PKG.Proposed Enhancement:
Modify the behavior of
go get -u
to detect when a package has been replaced in thego.mod
file.If PKG is replaced, display a clear message to the user indicating that PKG is not updated due to the replacement.
Provide guidance to the user, suggesting they check the go.mod file for the replacement settings.
Ideally, include a link to documentation that explains how to update replaces in the
go.mod
file.The message displayed to the user should be informative and actionable, helping them understand why PKG was not updated and what steps they can take to resolve the issue.
The link provided in the message should direct users to relevant documentation that explains the concept of replaces in the
go.mod
file and provides instructions on updating them.Impact:
Improved user experience: Users will receive clearer feedback when attempting to update replaced packages, reducing confusion and frustration.
Better understanding of go.mod functionality: Users will be guided to documentation that helps them understand and manage replaces in the go.mod file.
The text was updated successfully, but these errors were encountered: