Skip to content

feat(go): deliver outside files through resources again - #66

Closed
eunomie wants to merge 3 commits into
mainfrom
go-mod-resources-restored
Closed

eunomie wants to merge 3 commits into
mainfrom
go-mod-resources-restored

Conversation

@eunomie

@eunomie eunomie commented Oct 14, 2026

Copy link
Copy Markdown
Member

Drops #64's required ws *dagger.Workspace argument and run-time file discovery. Generation again lists outside files (from go.mod replaces, imports, embeds) in the entrypoint's resources, which dagger v1.0.0-beta.17 loads; the module builds and runs from currentModule.contextDirectory. #64's other fixes stay. A build missing a file now says to run dagger generate.

On beta.17, results are reused across sessions (0.3 s vs 7-10 s per call on a 16.6k-file workspace); calls from another repository or git work, which failed with ws.

Needs the engine to keep resources; without it (dagger/dagger#14661): replacement directory ../lib does not exist. Modules without outside files: byte-identical output. Limits: regenerate after changing replaces, imports or embeds; other outside files are absent at run time; over-inclusion (all build tags, whole embed directories).

e2e passes on beta.17 and beta.16; beta.12 floor pending.

Non-test: +301/-530.

Walkthrough: https://gistpreview.github.io/?98bb2a0f32e045d6ead3339aaaf44818

Generation finds the local replace targets go.mod requires, the packages
the module imports from them and the files those packages embed, and lists
them in the entrypoint's resources member. The engine (dagger
v1.0.0-beta.17 or later) loads them with the module, the entrypoint builds
from currentModule.contextDirectory, and function results are reused until
one of these files changes. Exported functions take no ws argument.

This removes the call-time workspace discovery of #64: the go-inputs
helper, the required ws check and docs/workspace-compilation.md. It keeps
released beta.17 runtime SDK (b988cb0), unified client unmarshalling and
the dagger runtime import alias (5464694), and embed walk errors (745835a,
moved to the scanner). Modules without files outside their directory
generate the same files as before.

A build that misses a listed file now says to run dagger generate instead
of only Go's go get suggestion.

Signed-off-by: Yves Brissaud <[email protected]>
The include fixture's functions take no ws again, and the checks of
collections, refusals, and calls on the beta.17 pin that reuse a result
across sessions and compute it again after an included file changes,
from another repository, by path and from a git source.

New: a caller module that reaches the app through a generated client, a
control module without files outside its directory whose result is
reused, and a stale resources list that fails with the hint to run
dagger generate. The floor check stays the beta.16 refusal, so the
workspace floor engine dependency goes.

Signed-off-by: Yves Brissaud <[email protected]>
Replace targets above the module copy lost their .. steps when resolved
from the copy near the file system root, so a module three levels below
the repository root (replace github.com/dagger/dagger => ../../..) failed
with "reads ../../../go.mod, which is missing".

Signed-off-by: Yves Brissaud <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant