-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go mod download does not work with submodules #31176
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
Comments
The |
I think that makes this a duplicate of #30850, but please reopen if you disagree. |
@bcmills that solves issue no.2 but not issue no.1 -- For issue 1: are there any conclusions on whether Thanks :) |
The module proxy protocol doesn't include nested modules within the parent module, so in general there is no way for the (We certainly do want to support module discovery and documentation, but |
https://index.golang.org/ now serves a feed of known module paths and versions at https://index.golang.org/index. That should be suitable for discovering modules programmatically — please file issues if you find that it is not. |
@bcmills I imagine for say
|
Summary
https://github.com/NYTimes/gizmo has two go.mod files: one at the root level and one inside the examples folder.
If I try to
go mod download
the top level module as such:GO111MODULE=on go mod download -json github.com/NYTimes/gizmo/@v/v1.2.4
Everything works correctly, but the
.zip
file that gets created does not have theexamples
folder...I imagine this is expected behavior because theexamples
folder and all of its sub-packages have their own go.mod file independent of the root one.Therefore, I would expect that
go mod download github.com/NYTimes/gizmo/examples/@v/v1.2.4
to work properly but currently it's not working (see error below)From the above behavior, I have two thoughts:
It would be nice if we can somehow conclude that a repository has multiple modules. This behavior comes in handy when it comes to code discovery and documentation websites such as when godoc.org supports modules. For example, godoc.org already has a Subdirectories section so it's become an expected behavior to see all subdirectories so we should at least see the
examples
folder or be hinted at a sub-module so we wouldn't be surprised if that folder is missing. I have a few ideas as to how we can find out about them, but first I'd like to see if that idea is well-accepted in the first place.We shouldn't error out on
go mod download
ing a sub-module especially that it's not included in the root-level module zip file.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?
What did you expect to see?
The sub-module correctly downloaded to $GOPATH/pkg/mod
What did you see instead?
The text was updated successfully, but these errors were encountered: