-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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: incompatible module version not detected by 'go run' or 'go build' #34330
Comments
I am not sure if this is a bug in build or doc. /cc @bcmills @jayconrod who know more about the nuances here. |
Thanks for the report. I can reproduce the described behavior starting from a clean module cache, and this is indeed a bug in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
With the recent changes in 1.16 the failure is not reproducable through the suggestions and default flow:
But the
|
Thanks for the updated steps to reproduce. I'll see if I can get to this for 1.17 once the lazy-loading changes are done. |
@bcmills Is this likely to happen for 1.18? Thanks. |
Sadly no. (Changes to version validation tend to catch existing broken modules, so they shouldn't happen during the freeze.) |
This issue is currently labeled as early-in-cycle for Go 1.21. |
This issue is currently labeled as early-in-cycle for Go 1.22. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create the following
go.mod
file:Create the following
main.go
file:What did you expect to see?
The toolchain should fail all interactions with
k8s.io/client-go
because of the combination of thego.mod
file at thev12.0.0
tag:[user@localhost test]$ go get k8s.io/client-go@v12.0.0 go: finding k8s.io v12.0.0 go: finding k8s.io/client-go v12.0.0 go: finding k8s.io/client-go v12.0.0 go get k8s.io/client-go@v12.0.0: k8s.io/client-go@v12.0.0: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v12 [user@localhost test]$ go run . go: finding k8s.io/client-go v12.0.0+incompatible go: finding k8s.io/client-go v12.0.0+incompatible go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required [user@localhost test]$ go build go: finding k8s.io/client-go v12.0.0+incompatible go: finding k8s.io/client-go v12.0.0+incompatible go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required [user@localhost test]$ go doc k8s.io/client-go/pkg/version go: finding k8s.io/client-go v12.0.0+incompatible go: finding k8s.io/client-go v12.0.0+incompatible go list -m: k8s.io/client-go@v12.0.0+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required
What did you see instead?
All parts of the toolchain I tested appear to re-find the problematic module on every invocation, however
go get
fails (as above),go doc
warns, and bothgo run
andgo build
succeed:The text was updated successfully, but these errors were encountered: