cmd/go: misleading "invalid version" error message for gopkg.in modules with mismatched module path #43809
Comments
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
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 |
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: