Repository navigation
Cut per-package module calls from package discovery - #73
Merged
Merged
Conversation
Package discovery called into gomod for a string join for every package directory (GoMod.subpath), and for a pattern match for every main package and every module's test setting (GoMod.selected). Each is a module call, with the fixed per-call cost of one; with a cold cache, as on a first build, the dagger repository's 810 packages made hundreds of them. They now run in process, as gomod's own code does them. Signed-off-by: Erik Sipsma <[email protected]>
Finding a module's go:generate packages globbed the whole workspace for each generate pattern, for every module, even when the module has no go:generate command to select from, as most don't. It now skips that when there is nothing to select. Signed-off-by: Erik Sipsma <[email protected]>
grouville
self-requested a review
October 21, 2026 19:19
grouville
approved these changes
Oct 21, 2026
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 21, 2026
…retries The golang workspace module (generate and test checks) still used dagger/go's pull/45 head, which is frozen at its September merge. Pin it to the dagger/go main merge of dagger/go#73, which also contains dagger/go#71 and dagger/go#72: - dagger/go#71 sets GOPROXY to proxy.golang.org|proxy.golang.org|direct in withGoCaches, so a module zip download that the proxy resets mid-stream is retried once against the proxy and, on another proxy failure, attempted directly from the origin. The check can still fail if that fallback fails. - dagger/go#72 and dagger/go#73 speed up and fix package discovery. The source names a commit rather than main because dagger.lock pins are not applied in Cloud's remote-workspace sessions, so main would float in CI. The dagger/go main entry in dagger.lock is refreshed to the same commit with dagger lock update. dagger/go now organizes checks and generators by package, so their names change: golang/generate-all/stale becomes golang/packages/generate/stale, golang/test-all becomes golang/packages/tests/test, and the golang/generate-all generator becomes golang/packages/generate. Update the release instructions' generate step to the new generator name. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
to sipsma/dagger
that referenced
this pull request
Oct 21, 2026
…retries The golang workspace module (generate and test checks) still used dagger/go's pull/45 head, which is frozen at its September merge. Pin it to the dagger/go main merge of dagger/go#73, which also contains dagger/go#71 and dagger/go#72: - dagger/go#71 sets GOPROXY to proxy.golang.org|proxy.golang.org|direct in withGoCaches, so a module zip download that the proxy resets mid-stream is retried once against the proxy and, on another proxy failure, attempted directly from the origin. The check can still fail if that fallback fails. - dagger/go#72 and dagger/go#73 speed up and fix package discovery. The source names a commit rather than main because dagger.lock pins are not applied in Cloud's remote-workspace sessions, so main would float in CI. The dagger/go main entry in dagger.lock is refreshed to the same commit with dagger lock update. dagger/go now organizes checks and generators by package, so their names change: golang/generate-all/stale becomes golang/packages/generate/stale, golang/test-all becomes golang/packages/tests/test, and the golang/generate-all generator becomes golang/packages/generate. Update the release instructions' generate step to the new generator name. Signed-off-by: Erik Sipsma <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This continues the discovery work from #72, which made package discovery much cheaper on large repositories. Two commits:
Package paths and selections in process.
Go.packagescalled into the gomod module for small string work. It made one call per package directory to join the module path and the directory (GoMod.subpath). It made more calls to check build and test selections against patterns (GoMod.selected). Each call from this module into gomod has a fixed cost of roughly 60 to 150 ms, mostly setting up the call, for a few string operations. On the dagger repository, with 810 packages, that adds up. These now run in this module, with the same rules as gomod'snormalize,subpath,selectedandmatches.No generate selection without go:generate commands. For each module, discovery checked its go:generate packages against the generate patterns. That globs the workspace once per pattern, even when the module has no go:generate commands, which is most modules. It now skips that step when there is nothing to select. The result is the same.
The module loads and discovers yq's packages on a released engine, with the same keys before and after each commit, and builds yq's binary.
Numbers
Discovery alone (
packages | keys) on a snapshot of the dagger repository, 80 Go modules and about 4,000 Go files. Before is dagger/go main with #72 and #71; after is this PR. Both ran on one Dagger Cloud engine with the beta.19 CLI running inside it, three runs each, and all returned the same 810 package keys.The first run of each is not a fair comparison: this PR ran second, on an engine already warmed by the runs before it. The later runs are the comparison. They are one set of runs on a shared engine, so a few seconds either way is noise. Discovery runs on every build call, so on the dagger repository this saves about the same time on each edit and each no-change build.