Skip to content

gobuild: run through the Go SDK's Dang entrypoint - #96

Closed
sipsma wants to merge 3 commits into
mainfrom
sipsma/gobuild-dang-entrypoint-v2
Closed

sipsma wants to merge 3 commits into
mainfrom
sipsma/gobuild-dang-entrypoint-v2

Conversation

@sipsma

@sipsma sipsma commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

gobuild now runs through the Go SDK's generated Dang entrypoint. A fresh engine reads gobuild's types from the generated internal/dagger/entrypoint/main.dang instead of building and running gobuild's Go code to ask for them, so loading dagger/go no longer pays for that build. gobuild's Go code is built only when one of its functions is called. Its API is unchanged.

go-sdk

The workspace installs go-sdk from the commit on main that merged dagger/go-sdk#76. That change makes a failing function's error text reach its caller through the entrypoint. Without it, a gobuild call whose build fails reports only "exit code: 2" instead of Go's error, and embed-check, which expects Go's message, would fail.

What it changes

Listing dagger/dagger's tests (dagger check --go --check test -l --all, 4,951 tests), Dagger v1.0.0-beta.24, one 16-CPU arm64 machine, main (as of #89) against this branch, 3 runs each, interleaved, each on a fresh engine. Medians, with the 95% interval of the difference:

Listing main this PR Change
Fresh engine 13.09 s 8.97 s 4.20 s faster (3.92 to 4.52 s)
Unchanged, warm engine 1.55 s 1.52 s no measurable difference (−0.09 to +0.00 s)
After an edit, warm engine 2.12 s 2.17 s 0.05 s slower (0.01 to 0.07 s)
  • The gain: on a fresh engine, gobuild's types come from the Dang file. Before, the engine generated gobuild's Go bindings, compiled it and ran it once to get them, and unpacked the Go SDK's image to do so.
  • The cost: a few hundredths of a second on a warm engine after an edit.

Compatibility

gobuild still needs Dagger v1.0.0-beta.22 or later, as on main, for File.extract and Container.withMountedFiles. Its manifest no longer declares an engineVersion. The generated entrypoint itself needs v1.0.0-beta.18 or later.

Commits

  1. Generate gobuild with the Go SDK's Dang entrypoint, unified clients and the global client, from go-sdk v1.4.0 with fix(go): surface the function's error text from the entrypoint go-sdk#76. The generator's first run kept the old embedded bindings in internal/dagger/core; a second run removed them.
  2. Build gobuild's containers and directories with dagger.io/dagger/core's constructors instead of the global dag client, and stop generating the global client.
  3. Pin go-sdk to the commit on main that merged fix(go): surface the function's error text from the entrypoint go-sdk#76. The generated files already came from that code, so regenerating changes nothing.

Generate gobuild with the Go SDK's Dang entrypoint, so the engine reads
its types from the generated entrypoint/main.dang instead of building
and running the module to ask for them. The module's Go code is built
only when one of its functions is called.

The workspace installs go-sdk v1.4.0, which has the generator. Its
first run kept the old embedded bindings in internal/dagger/core; a
second run removed them.

Signed-off-by: Erik Sipsma <[email protected]>
Build gobuild's containers and directories with dagger.io/dagger/core's
constructors instead of the deprecated global dag client, which the Go
SDK no longer generates.

Signed-off-by: Erik Sipsma <[email protected]>
Pin the workspace's go-sdk to the commit on go-sdk main that merged
dagger/go-sdk#76, which makes a failing function's error text reach its
caller through the entrypoint. gobuild's generated files already came
from that code, so regenerating changes nothing; go-sdk/generate/stale
now agrees with them.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma

sipsma commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #95, which now carries this PR's commits unchanged alongside the rest of the per-package build.

@sipsma sipsma closed this Nov 5, 2026
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