You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior of go get -u PKG does not adequately handle packages that have been replaced in the go.mod file. This proposal aims to improve the user experience by providing clearer information when a replaced package is encountered during the go get -u operation.
Details:
When a user runs go get -u PKG and PKG has a replacement specified in the go.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 the go.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:
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.
Would you want to print an error message for each replaced package?
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 replace golang.org/x/tools => ../../tools, when we run go get -u golang.org/x/tools after we print the message (for example) go: upgraded golang.org/x/tools v0.17.0 => v0.20.0 we also print something like go: golang.org/x/tools is replaced at all versions so upgrade may not apply to builds from this module.
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: