-
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: [email protected]+incompatible currently allows Semantic Import Versioning to be optional #32695
Comments
https://golang.org/cl/181881 might help with this. |
Hmm, this is unfortunate. In direct mode, it seems we correctly don't list these versions:
However, the proxy knows about them.
And in your example, the Go command validation doesn't catch the problem with these versions, even with Patching in https://golang.org/cl/181881, it looks like a go.mod with a version like this will break the build in direct mode, since it's now validated. We should figure out how many modules have invalid requirements like this. |
cc @bcmills |
Ugh. Agreed, we need to fix this and we need to figure out how big the crater will be. |
I think another example of this is EDIT: On a second look, setting |
On
That first result is the intended behavior; the second is this bug. |
Change https://golang.org/cl/181881 mentions this issue: |
Two more examples of modules that now fail validation:
|
This is a spinout from "Factor 2" from #31543 ("cmd/go: creating v2+ modules has lower success rate than it could").
Compared to Go 1.11 and 1.12, current tip / 1.13 might have increased the modes of interaction that work with v2+ modules that have not adopted Semantic Import Versioning.
What version of Go are you using (
go version
)?go 1.12.6
Does this issue reproduce with the latest release?
Yes, including tip as of yesterday (
devel +bc27b64d Tue Jun 18 03:41:59 2019 +0000
)What did you do?
Observe people accidentally creating and using modules that have v2+ semver tags but that have not adopted Semantic Import Versioning.
For example, if there is a module
example.com/foo
that:go.mod
file (that is, it has adopted modules)module
line readsmodule example.com/foo
(without the in theory required/v2
)then this still works for a module-based consumer, even though the module is in a "bad" state:
go get example.com.com/[email protected]+incompatible
This means people can and do create usable v2+ modules that did not adopt Semantic Import Versioning, and consumers can and do consume those "bad" modules.
However, other things such as upgrades or
go get example.com.com/foo@latest
do not work as expected, which leads to confusion.What did you expect to see?
Some type of warning when consuming a v2+ module that has not adopted Semantic Import Versioning (or perhaps an error in the future after the ecosystem has more time to adapt and more tools exist to help prevent or catch mistakes).
What did you see instead?
Here is a concrete example. This uses github.com/pierrec/lz4:
First, here is Go 1.12 successfully building a consumer importing the "bad" v2.0.6, as well as this shows a subsequent upgrade not working in 1.12.
Second, tip is also able to build using the "bad" v2.0.6, but now tip allows upgrading.
The text was updated successfully, but these errors were encountered: