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: unable to get major versions/sub modules when using vanity urls #58654
Comments
@golang/tools-team |
The error message here is not wrong. At the tag |
But should I have to modify the |
Ah, well there's your problem. The <meta name="go-import" content="tomasruud.github.io/gvm/v2 git https://github.com/tomasruud/gvm"> Note that per https://go.dev/ref/mod the first field of the So the |
Thank you! Seems like changing the first part of the content field to align with the name of the root module did the trick. So I guess that was the issue all along. Perhaps the documentation could benefit from some examples around this matter, as it wasn't entirely clear that you had to do it this way, just by reading it. |
Sorry to post in a closed issue here, but it appears that, despite the name fix above, it is still not possible to combine vanity imports and submodules? e.g.,:
This is with go version 1.21.0 Is it prohibitively difficult to fix this limitation? |
@rcoreilly I think this should be working, at least I tried to add a new tag now for the |
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?
I have a small package set up at https://github.com/tomasruud/gvm for reproducing this issue. This package is set up with vanity urls, by using Github pages as hosting. The root of the package has module name
tomasruud.github.io/gvm
, which is linked up with Github pages, so when you try to get https://tomasruud.github.io/gvm you'll be served an html page with thego-import
set to point to the Github repository.This works fine for major version v0 and v1, but once I try to add a
v2
module in my project, go mod seems to be unable to find thetomasruud.github.io/gvm/v2
module. I have added v2 as a submodule by following the documentation, so the code lives in a v2 folder under the root of the project, with its own go.mod file.The same issue happens with other submodules in the project. I have tried adding a
foo
module and tagging it accordingly, but go mod seems unable to find this module also.What did you expect to see?
I would expect go mod to be able to resolve the submodules based on the tags and subfolder from the repository.
What did you see instead?
Instead I'm getting errors like these
$ go get tomasruud.github.io/gvm/v2@v2.0.0 go: tomasruud.github.io/gvm@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("tomasruud.github.io/gvm/v2")
The text was updated successfully, but these errors were encountered: