Repository navigation
feat(go): discover external compilation inputs from workspaces - #64
Merged
grouville merged 8 commits intoOct 14, 2026
Merged
Conversation
Rediscover imported packages, local replacements and embedded files for workspace-dependent entrypoint calls. Require a workspace on affected constructors and functions so a cached result cannot skip discovery. Adapt the local package scanner from Yves Brissaud’s PR #63. Co-authored-by: Yves Brissaud <[email protected]> Signed-off-by: Guillaume de Rouville <[email protected]>
grouville
force-pushed
the
feat/workspace-compilation-inputs
branch
from
October 13, 2026 22:45
7541bd4 to
0122ad6
Compare
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
Signed-off-by: Guillaume de Rouville <[email protected]>
This was referenced Oct 14, 2026
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 builds on #63 and keeps Yves' automatic Go file discovery.
Workspace compilation requires Dagger beta.17 or later: the SDK uses
currentModule.sourceSubpathfor calls between sibling modules. Its minimum-version check now runs beta.17. The existing beta.16 entrypoint and beta.12 runtime checks stay in place.The confusion came from mixing two things:
For a module that compiles with files outside its own directory, every exported constructor and function must take a required
ws *dagger.Workspace.Concretely:
goClient.New(ws).Build(ws).The workspace is passed before Dagger checks the function cache. With a fresh local workspace session, the call runs again, so the SDK can read the current inputs. It follows Go imports, local
replacetargets andgo:embed, then imports the external files the compiler needs.Having
wsonly on the constructor is not enough. The constructor could return the same object, and another function withoutwscould still return an old cached result. Each affected function needs the workspace too, even if its Go body does not use it.Rerunning the function does not mean rebuilding everything. Go compilation still caches by file content:
So, under this workspace contract, we do not need the engine's resource hook to invalidate these calls. Module authors filter the files their own pipelines need; the Go SDK handles compiler inputs. Collection lookups carry the workspace in their receiver and keep their key-only API.
The same explanation and a small Go example are in the SDK help and caching guide.
Self-contained modules still work without
ws:TestGenerateFreshEmbeddedModuleWithoutLocalSDKgenerates and executesEcho(value string)without it. The external-input fixture separately verifies that omitting the required workspace is rejected.Checked on the unmodified beta.17 engine and an engine rebuilt from the standalone resource revert: changing an external embedded file changes the result in a fresh session, without regeneration. The timestamp check confirms that fresh workspace calls rerun the function. Discovery, entrypoint and module-codegen tests also pass. The CLI port exposed a missing import alias for private dependency-client fields; this PR fixes their generated serialization and tests regeneration with an aliased private field.
The integration checks and module ports also caught issues in starter generation, imports, and private dependency clients. This PR fixes them and adds regressions, including a sibling call that sees a changed external embed without regeneration. Compiler helpers can be upgraded while preserving author edits, and their generated Go files carry the generated-code header. Embed discovery also propagates file-read errors.
The engine rollback (dagger#14661) and module ports (dagger#14664) are separate PRs. This PR targets Yves'
go-mod-include-engine-formbranch and does not publish a tag.