-
Notifications
You must be signed in to change notification settings - Fork 18k
x/exp/cmd/gorelease: avoid using -mod=mod and support lazy module loading #41456
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
Change https://golang.org/cl/255597 mentions this issue: |
FWIW, I think the temporary- |
I think you can fix the |
Ah, but I guess the
|
I thought about The bigger problem is if the module's |
Yeah, considering all the alternatives I suspect that the |
Quick check - is this discussion centered around making I ask because I was wondering why we're talking about (sorry for the potentially unintelligent question, just catching up :) ) |
This fixes test failures when gorelease is used with the tip Go 1.16. For golang/go#41456 Change-Id: I9a1452518113f595d9c94fb394f0aecbcc80b95f Reviewed-on: https://go-review.googlesource.com/c/exp/+/255597 Trust: Jay Conrod <jayconrod@google.com> Trust: Jean de Klerk <deklerk@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jean de Klerk <deklerk@google.com>
@jadekler Right, this is mainly about With With |
Ahhh. Thank you! This helps greatly. |
Change https://golang.org/cl/263178 mentions this issue: |
…ding Details: - Replaces `go list -mod=mod` with `go list -mod=readonly`. - Switches to `go get -d` to download dependencies rather than relying on `go list` doing so. - Missing go.sum/go.mod data is now an error. This CL will be followed by a CL that ensures the filepath.Walk stops at submodules, and a test asserting that. I figured it'd be good to do separately since this CL is getting to be hefty. Give a shout if you prefer otherwise! Updates golang/go#41456 Change-Id: I66f12fe0325e4fed432d8b10c1fe977068e4a030 Reviewed-on: https://go-review.googlesource.com/c/exp/+/263178 Run-TryBot: Jean de Klerk <deklerk@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Trust: Jean de Klerk <deklerk@google.com>
Quick note: I intend on finishing this out by adding a bit more logic+test around not walking into submodules when considering which packages to import in |
Change https://golang.org/cl/287972 mentions this issue: |
Details: - Adds a test for the missing req submodule case. However, it turns out we don't need any code in the filepath.Walk to handle submodules, since earlier in copyModuleToTempDir we only copy the module's contents (not any submodule contents) with zip.CreateFromDir. This means that prepareLoadDir is never going to consider any submodule content, and we don't have to build logic for that. The test will maintain that guarantee. - Remove some extraneous go.mod dupes from other tests. - Remove a TODO related to filepath.Walk submodule checking which is no longer needed. Fixes golang/go#41456 Change-Id: Ib0bac2fb227d4175c31603880b629374991b8bde Reviewed-on: https://go-review.googlesource.com/c/exp/+/287972 Run-TryBot: Jean de Klerk <deklerk@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jean de Klerk <deklerk@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
gorelease
usesgo list $modpath/...
to build a list of packages it needs to load and compare (where$modpath
is the path of the module being released). Go 1.16 has-mod=readonly
on by default (#40728), so if the module is missing one or more sums, this may result in an error likeWe can work around this temporarily by explicitly using
-mod=mod
.Go 1.16 will also support lazy module loading (#36460). This may require changes to the way
gorelease
generates temporarygo.mod
files for loading packages in downloaded modules, since nothing is imported in those temporary modules. We can work around this temporarily by usinggo 1.16
in temporarygo.mod
files.A possible solution to both problems is to replace the
go list
call with a walk of the directory tree, listing non-main, non-internal packages (importable by other modules). Once we have such a list, we can generate a temporary .go file that imports those packages, then rungo get -d
on that temporary package. That will ensure it's safe to callpackages.Load
later.cc @jadekler @bcmills
The text was updated successfully, but these errors were encountered: