-
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: misleading "invalid version" error message for gopkg.in modules with mismatched module path #43809
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That error is coming from here: go/src/cmd/go/internal/modfetch/coderepo.go Lines 769 to 771 in f1980ef
See previously #34254. |
I think the relevant check is here: go/src/cmd/go/internal/modfetch/coderepo.go Lines 815 to 822 in f1980ef
|
Prompted by that comment, I'm not sure what the use of the
but in that case why not use the canonical path instead?
So I agree that the error message we're emitting is confusing, but I'm not sure that it should be changed to a non-error. |
Context for this was a 404 error on pkgsite. They're trying to understand why they show errors for some pages where godoc.org succeeds. Since |
We could perhaps weaken the That would change the semantics of |
See previously #34254. |
Just to add a note: this is a bug with the way In general, a replacement module should have the original module path in its |
Change https://golang.org/cl/324470 mentions this issue: |
Change https://golang.org/cl/338150 mentions this issue: |
This is in the Go1.18 milestone. Is it likely to happen for 1.18? Thanks. |
@bcmills This is in the 1.18 milestone; time to move to 1.19? Thanks. |
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?
Run
go mod download
on a module with agopkg.in
module path, when the actualgo.mod
file has a different module path.What did you expect to see?
go mod download
should succeed.go get
and anything else that actually loads the module graph should fail with a mismatched module path error message.In general,
go mod download
should succeed when the module path on the command line doesn't match the actual module path ingo.mod
. If it didn't, module version replacements wouldn't work. For example,go mod download github.com/google/go-cloud@v0.21.0
works even though it declares itself asgocloud.dev
.It's fine that the go command checks that the version matches the major version suffix, but it should check that against the module path named on the command line, not the module path in
go.mod
.What did you see instead?
gopkg.in
module paths must have a major version suffix, in this case,.v1
. The go command is reporting that the actual module path in go.mod,github.com/golang/mock
does not end with.v1
.cc @bcmills @matloob @julieqiu
The text was updated successfully, but these errors were encountered: