-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: non-top-level packages ending in "/vendor" are omitted from module zip files #37397
Comments
Change https://golang.org/cl/220640 mentions this issue: |
You are correct: this is closely related. https://play.golang.org/p/zCP7U8cKAGc |
CC @jayconrod @matloob, @FiloSottile FYI. (I don't think we can plausibly fix this without invalidating checksums, though.) |
Change https://golang.org/cl/220657 mentions this issue: |
This function is apparently unused since CL 204917. Updates #35290 Updates #37397 Change-Id: Id7f5f5d5176fdbd1c5c6227e81d0854ceafc3f12 Reviewed-on: https://go-review.googlesource.com/c/go/+/220640 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
I had thought that the known bug in isVendoredPackage was strictly conservative, but it turns out not to be. Updates golang/go#37397 Updates golang/go#31562 Change-Id: I60f6062c41ec2d116766930f751d7df083535355 Reviewed-on: https://go-review.googlesource.com/c/mod/+/220657 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
I suppose we could gate this sort of changes on the |
@FiloSottile Unfortunately not. Old versions of |
That proposal is #30369, but it seems unlikely to be accepted. |
To be more specific and confirm, do you mean without invalidating checksums of the affected modules; i.e., modules that have a non-top-level package with "/vendor" import path suffix that was unfortunately excluded from the .zip? |
Right. If we fixed this, then for a given repository at a given commit, we would include a different set of files in the module zip file. The zip file would have a different sum. We don't have any safe mechanism for making that kind of change (though #30369, if implemented, is a possibility). The only change we can make is adding files that previously caused hard errors (for example, we could expand the set of allowed characters or increase the file size limit). We can't add files that were previously excluded. |
The unfortunate label indicates this is a valid issue (though possibly fairly minor; given it affects a small percentage of possible package names) but there doesn't appear to exist any good way to make progress on resolving it.
Perhaps it can work for supported versions of Go if we gate the change on a future (I also considered gating on a future date, but that seems strictly worse.) The overhead in such a change might be large enough that it'd be worth bundling multiple known module boundary improvements into one rather than doing it individually. Also, all future Go releases would need to implement both behaviours to be able to handle both old and new modules—so there are long-term costs in addition to transition costs. |
Post go1.21 there seems to be a way to make progress on resolving this. We should consider if it's worth fixing. |
Change https://go.dev/cl/584635 mentions this issue: |
This fixes a bug where vendor/modules.txt was accidently included during a module download. This CL trims this file for 1.24 modules and beyond. We cannot remove this for earlier Go versions because this would alter checksums and cause a checksum failure. This CL also adds the ability to case on the Go version in the root's go.mod file, enabling future behavior changes if necessary. Fixes: golang/go#63395 Updates: golang/go#37397 Change-Id: I4a4f2174b0f5e79c7e5c516e0db3c91e7d2ae4d9 Reviewed-on: https://go-review.googlesource.com/c/mod/+/584635 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
Change https://go.dev/cl/619175 mentions this issue: |
The following program fails in both go1.14rc1 and go1.13.7 darwin/amd64.
Fails with:
If I add a replace directive for that module:
It compiles/runs fine:
I understand that the vendor top level folder in a module has a special meaning, but according to https://golang.org/ref/spec#Packages that package name should be fine -- and just deleting it sounds rather harsh.
I assume this is related to #31562 -- I have not read that one in detail, but I don't see how the conclusion can be correct.
github.com/bep/testmodlib/somepackage/vendor
seem to be a valid package with a replace, and I assume that the compiler works as expected here.The text was updated successfully, but these errors were encountered: