-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: go.mod can not lock indirect dependencies version #40784
Comments
There isn't a way to enable locking indirect dependency versions in libraries in the general case, as that would cause problems elsewhere. It was considered during the design of the Minimal Version Selection algorithm (see https://research.swtch.com/vgo-mvs). If you're not looking to update indirect dependencies, you probably should not use Finally, in the example you shared, a jump from v1.0.0 to v2.0.0 is not expected to be backwards compatible per semantic version rules. Did you mean to use something like v1.0.0 to v1.1.0 instead? I believe this is working as intended. If you think there is a specific problem, please elaborate. /cc @bcmills @jayconrod @matloob per owners. |
This does seem like it's working as intended. Requirements in Note that higher major versions (v2.0.0 and above) technically belong to different modules. So if |
At present, there are indeed many upgrade management solutions in github that do not use the standard go package. When using these packages, you often use |
Modules work differently than other dependency management systems, which are traditionally designed around constraint satisfaction algorithms. The module system is designed around minimal version selection, which is a fast, predictable algorithm at the cost of some flexibility. Modules must follow semantic versioning and must declare module paths matching their major versions. As long as those rules are followed, You may find the vgo blog posts interesting, especially The Principles of Versioning in Go. They go into depth about the initial design of modules. Closing this issue, because it doesn't sound like there's a specific bug to fix here. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
There are 3 go modules A: v1.0.0, B:v1.0.0, C:v1.0.0. Now it is known that B:v1.0.0 depends on A:v1.0.0, and C:v1.0.0 depends on B:v1.0.0. When B:v1.0.0 -> B:v2.0.0, A:v1.0.0 -> A:v2.0.0 (incompatible upgrade), use
go get -u B
to upgrade the version of B in the C project, B was upgraded to v2.0.0, and A was also upgraded to v2.0.0, causing the C project to fail to run.What did you expect to see?
I hope lock the indirect dependency version
What did you see instead?
The text was updated successfully, but these errors were encountered: