Skip to content

feat(go): target v1.0.0-beta.27 - #105

Merged
eunomie merged 21 commits into
mainfrom
sipsma/default-target-beta27
Nov 16, 2026
Merged

eunomie merged 21 commits into
mainfrom
sipsma/default-target-beta27

Conversation

@sipsma

@sipsma sipsma commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The Go SDK has generated modules for v1.0.0-beta.25 by default since beta.25 was the newest release. beta.26 and beta.27 have shipped since. This moves the default to v1.0.0-beta.27.

What it changes for users

  • New modules target beta.27. They pin dagger.io/dagger v1.0.0-beta.27, and the release in flight a scope can pin moves to beta.28.
  • Modules build with dagger/go's per-package build by default. An entrypoint module that targets beta.26 or later, new or existing, builds with dagger/go unless it sets daggerGo = false. A module that targets an older release builds with go build, as before.
  • go build mounts Go cache volumes only where it must. The plain build mounts go-sdk-v2-mod and go-sdk-v2-build only for targets older than beta.26, whose engines can't run the per-package build.
  • First calls get faster once the engine image follows. The engine image ships dagger.io/dagger already compiled, at the Go SDK's default target. Once dagger/dagger pins this SDK, a new module's first call on a fresh engine no longer compiles dagger.io/dagger, dagger.io/dagger/core and dagger.io/dagger/engineconn.
    • Measured on engines built from dagger/dagger main and from main with this SDK pinned: a new beta.27 module's first call went from 7.16 s to 5.95 s median. That's 6 interleaved pairs on one 16-CPU arm64 machine, and it was faster in every pair.
    • A fresh dagger check -l of dagger/dagger didn't change.

The end-to-end checks

A beta.18 engine can't load what beta.27 generates: the manifest lists dagger/go as the entrypoint's dependency, and the code uses beta.26's naming. So:

  • The main e2e engine is now built from the v1.0.0-beta.27 release instead of beta.18.
  • A new module's expected manifest lists dagger/go.
  • The sources check, and the manual floor checks, keep a beta.18 engine of their own, with fixtures that target beta.18. That way the floor coverage stays: beta.27 reads a module's include instead of calling its sources function. The beta.12, beta.16 and beta.17 floor engines are unchanged.

Running the suite on beta.27 also needed:

  • No dang-sdk in the nested workspace. No check used it, and its locked commit doesn't load on beta.27. beta.27 runs a load check for every module in a workspace.
  • The upload checks run as a session's own client. The ignore checks read the engine's upload spans from their CLI's collector. Since dagger/dagger #15100, a CLI nested in an exec no longer passes the engine's spans to its collector. The checks now run from engine-e2e, where the CLI is a client of the engine under test in its own session.
  • The git-source check commits the entrypoint's dang.toml. This repository's .gitignore ignores dang.toml, so the check's git module was served at the engine's fallback release, which lacks Directory.withPlatform.
  • Two expectations follow beta.27. The go build entrypoint writes its binary to /tmp/dispatch/dispatch from beta.26 on. And beta.27's built-in Go SDK compiles a module's packages to generate its code, so a test module on the Go runtime needs a main.go with package main.

A fix it turned up

A new module on the Go runtime, in a directory that already has a go.mod, got a starter importing dagger/<name>/internal/dagger instead of that go.mod's module path, so it didn't build. The starter now uses the go.mod, as a new entrypoint module's already did. beta.27 shows the failure because it compiles the module during code generation.

A module with a +collection type also failed to generate under dagger/go. Generation overlays the collection's runtime sources on the module context in the entrypoint, and it could only find the context in a go build entrypoint. It now overlays them on the workspace dagger/go builds from too, with a unit test and an e2e check for a new collection module.

A module's Go code in a subdirectory

Generation keeps a module's Go code in a subdirectory of its directory, as dagger.json's source names it; the manifest stays in the module directory and names the entrypoint there. That is what dagger/dagger's PHP, Java and Elixir runtimes need to move to this SDK. For such a module, CurrentModule().Source() reads are relative to the module directory, as docs/outside-files.md describes.

Matching what the built-in Go SDK passes on

  • A module's description comes from its package doc comment. The generated entrypoint returns it from a description member. Engines without dagger/dagger's matching change ignore it.
  • A failed function's caller gets the engine's error with its values, such as a failed exec's exit code, stdout and stderr, for modules that target v1.0.0-beta.28 or later. That needs dang: fail a function with the Error it raises dagger#15161. Older targets keep the message alone.
  • Unified module bindings leave out the main-client-only calls that the engine leaves out of the module schema (dag.Host(), dag.Engine(), dag.CurrentWorkspace() and the others). They forward only the core fields the module's own dagger.io/dagger has.
  • The entrypoint contract check runs at the Dang version the entrypoint's dang.toml declares.

Pinned images

A generated go build entrypoint names its runtime and Go images by digests pinned in versions.toml (runtimeImage, goImage), not by whatever the generating session's lock or registry resolved, so two machines generate the same code for the same module. A module on a Go version other than the default names that version's tag.

Known limitation

A module that is itself named go can't build with the per-package build on beta.27 engines; until the engine fix ships it needs daggerGo = false. In its entrypoint, go resolves to the module itself instead of dagger/go. The fix is in the engine and reaches users with the next engine release.

beta.27 is the newest release of dagger.io/dagger, and the default had
stayed at beta.25 since beta.25 was the newest. The release in flight a
scope can pin moves to beta.28.

Signed-off-by: Erik Sipsma <[email protected]>
A module generated for beta.27, the default target, uses that release's
naming and lists dagger/go as its entrypoint's dependency, and a beta.18
engine can't load either. Build the e2e engine from beta.27, and expect a
new module's manifest to list dagger/go. The floor checks keep their own
older engines.

Signed-off-by: Erik Sipsma <[email protected]>
beta.27 reads a module's include in place of calling its sources
function, so the sources check on the e2e engine no longer ran sources.
Run it, and the manual floor checks, on beta.18 as before, with fixtures
that target the floor release.

Signed-off-by: Erik Sipsma <[email protected]>
No check uses it, and its locked commit doesn't load on beta.27, which
runs a load check for every module of a workspace, so every check failed.

Signed-off-by: Erik Sipsma <[email protected]>
From beta.26 the go build entrypoint writes its binary into a directory it
declares for a platform, /tmp/dispatch/dispatch. And beta.27's built-in Go
SDK compiles a module's packages to generate its code, so the runtime steps
of the compatibility check get a main.go with package main, as a module on
the Go runtime has.

Signed-off-by: Erik Sipsma <[email protected]>
The ignore checks read the engine's upload spans from the collector of the
CLI they run. That CLI ran nested in an exec, and since dagger/dagger
#15100 a nested CLI no longer passes the engine's spans to its collector,
so on beta.27 the checks saw no upload at all. Run them from engine-e2e,
where the CLI is a client of the engine under test in its own session.
The beta.18-24 driver goes with them: engine-e2e runs them on beta.27.

Signed-off-by: Erik Sipsma <[email protected]>
A new module on the Go runtime in a directory that already has a go.mod
got a starter that imports dagger/<name>/internal/dagger, whatever module
path the go.mod declares, so the module didn't build. Render the starter
with that go.mod, as a new entrypoint module's already is.

Signed-off-by: Erik Sipsma <[email protected]>
This repository's .gitignore ignores dang.toml, so the git module the check
builds had no entrypoint dang.toml, and the engine served it at its
fallback release, beta.24. Code for beta.27 calls Directory.withPlatform,
which that release lacks. A module commits the file, as the README says.

Signed-off-by: Erik Sipsma <[email protected]>
A module with a +collection type builds its process from runtime sources
that generation prepares beside it. Generation overlays them on the
module context in the entrypoint, and could only find the context in a
go build entrypoint, which mounts it twice. An entrypoint that builds
with dagger/go reads the context as a workspace in dispatch and mounts
it once in call, so generation refused it: every new module with a
collection failed once dagger/go became the default build.

Overlay the runtime sources on the workspace dagger/go builds from as
well.

Signed-off-by: Erik Sipsma <[email protected]>
…er/go can't build

A generated entrypoint that builds its module's process with go build
mounted the go-sdk-v2-mod and go-sdk-v2-build cache volumes for every
target. The build is one exec, which the engine caches by its inputs, so
the volumes only carry downloads and compiled packages from one build to
the next outside that cache. A module that targets v1.0.0-beta.26 or
later can build with dagger/go's per-package build instead. dagger/go's
gobuild, which does that per-package build, is itself built with go
build, so every per-package build used these volumes through it.

Mount them only for a target older than dagger/go's floor, whose engines
can't run the per-package build.

Signed-off-by: Erik Sipsma <[email protected]>
An existing module kept go build when it was generated again, even for a
target whose engines run dagger/go's per-package build, unless it set
daggerGo = true. Only new modules got the per-package build, and now that
go build mounts no Go cache volume for those targets, an existing module
on it rebuilt every dependency after each edit.

Unset daggerGo now selects dagger/go for every entrypoint module that
targets v1.0.0-beta.26 or later, new or existing. daggerGo = false keeps
go build. A module that targets an older release builds with go build, as
before.

The checks that migrate an existing module expect dagger/go; the checks
of go build's compiler image set daggerGo = false.

Signed-off-by: Erik Sipsma <[email protected]>
A module can keep its Go code in a subdirectory of the directory that holds
its manifest, as "source": "runtime" says in dagger.json. Generating it with
dangEntrypoint refused that source, so such a module could move to a Dang
entrypoint only by making the subdirectory the module's root, which changes
the reference the module is loaded by.

Generation now keeps the layout. The go.mod, the generated Go files and the
entrypoint go into the subdirectory, and dagger-module.toml stays in the
module directory and names the entrypoint there, such as
./runtime/internal/dagger/entrypoint. The next generation finds the Go code
from that path. The generated entrypoint builds and runs the subdirectory,
and source maps name files from the module directory.

A source outside the module directory is still refused. A module in a
subdirectory whose build reads files outside the subdirectory is refused
too: its include list would have to name paths from the module directory.

Signed-off-by: Erik Sipsma <[email protected]>
A collection's runtime sources are written beside the entrypoint, in the
module's Go code directory, but the entrypoint read them from the module
directory. In a module whose Go code is in a subdirectory, it looked for
them in the wrong place.

The entrypoint now reads them from the Go code directory, as it builds the
module. The docs also say what changes for a module's own code: the module
directory, not the subdirectory, is now its source.

Signed-off-by: Erik Sipsma <[email protected]>
A module on the Go runtime takes its description from its package's
doc comment. On the Dang entrypoint the description was dropped: the
entrypoint returned only the module's types, and the doc comment
reached neither the entrypoint nor the manifest.

The generated entrypoint now returns the doc comment from a description
member, which the engine reads as it reads prebuild and runtimeImage.
An engine that doesn't read the member ignores it, and a module without
a doc comment gets no member.

Signed-off-by: Erik Sipsma <[email protected]>
Generation type-checks the entrypoint it writes with the
entrypoint-contract helper, which checked it at its own Dang's current
version. The engine evaluates the entrypoint at the version its
dang.toml declares, 2.1. The two agreed while the helper's Dang was
v2.1.4.

The helper now moves to the Dang that the engine uses
(683ac69d8a), whose interfaces are structural, so the helper accepts
an entrypoint that raises a Dagger Error, as the engine does. That Dang
refuses forms that 2.1 allows, such as a bare type pattern. So
generation passes the helper the version it declares in dang.toml, and
the helper checks the entrypoint at that version.

Signed-off-by: Erik Sipsma <[email protected]>
On the Go runtime, a function that returns the error of a failed exec
fails with that error's exit code, stdout and stderr: its process
returns a Dagger Error that carries them. On the Dang entrypoint, the
dispatcher reported only the error's message, and the entrypoint raised
that. So the caller saw "exit code: 1" without the output.

From v1.0.0-beta.28 on, the release that has dagger/dagger#15161, a
failed function's dispatcher builds a Dagger Error as the Go runtime
does: the message of the GraphQL error the function returned, and each
of its extensions as a value. It then reports the Error's ID after the
message. The entrypoint loads the Error by its ID and raises it, and
the engine hands the caller that Error. Its traceparent still points at
the exec that failed. If the Error can't be built, the entrypoint
raises the message as before. Modules that target an older release keep
the message, since their engines can't raise an Error.

The e2e fixture's function fails with an exec that prints output and
exits with 42. Its caller gets an exec error with that exit code and
output. That needs an engine with #15161, which no release has, so the
check runs from engine-e2e on a supplied engine source and isn't in CI
yet.

Signed-off-by: Erik Sipsma <[email protected]>
The Go runtime generates a module's bindings from the schema the engine
serves module SDKs, which leaves out what only the engine's main client
may call: host, engine, currentWorkspace, engineVolume, sshfsVolume and
setSessionTitle. So module code that calls dag.Host doesn't compile.
A module's unified bindings embedded all of dagger.io/dagger/core's
Query instead, so the same code compiled.

The unified bindings now forward each core field of the module schema's
Query to core's Query, and nothing else. The list is the schema the
engine serves, not a copy. Module code that calls dag.Host, dag.Engine
or dag.CurrentWorkspace fails to compile with "undefined", as on the Go
runtime, while the rest of core's Query is still offered.

Signed-off-by: Erik Sipsma <[email protected]>
Unified module bindings forward each core field of the module schema's
Query to dagger.io/dagger/core's Query. An engine can serve an older
release's view fields added after that release: a beta.27 engine serves
identifier, formatIdentifiers and namingDictionary in beta.18's view,
which beta.18's library lacks. So a unified module that targets beta.18
failed to compile on that engine: "r.coreQuery.Identifier undefined".

Generation now reads the methods of core.Query from the library the
module builds with, the replacement's when go.mod replaces it. The
bindings forward only the fields of the module schema that the library
has. The e2e check generates such a module for beta.18, and it compiles.

Signed-off-by: Erik Sipsma <[email protected]>
…lects

Go applies a replacement of a module's selected version over one of
every version, whichever comes first in go.mod. When go.mod had both
for dagger.io/dagger, QueryMethods read the library of whichever came
last. So unified bindings could forward fields the library Go builds
with lacks, the failure the previous commit fixes. It now reads the
replacement of the version when there is one, else the one of every
version.

Signed-off-by: Erik Sipsma <[email protected]>
Generation wrote the runtime image, and the Go image a go build
entrypoint builds in, by the digest the session resolved their tags to.
That digest is whatever the workspace's lock or the registry holds when
generation runs: dagger/dagger's lock, go-sdk's and a workspace without
an entry resolve alpine:3.22 to three different digests. A module
generated in one place, or before a tag moved, was stale in another,
and the stale check failed on changes that touched no module.

versions.toml now pins both images by digest, and generated code changes
only when it does. A module on another Go version than the default names
that version's tag, which its build looks up.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit that referenced this pull request Nov 13, 2026
A measurement branch, not for merging: on go-sdk #105's head, it pins
dagger/go #104 at 78c4039 (with the dependency call's package list passed as a file),
so a test workload can be generated against it.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit that referenced this pull request Nov 13, 2026
A measurement branch, not for merging: on go-sdk #105's head, it pins
dagger/go #104 at da4f104 (without the dependency call's package list passed as a file),
so a test workload can be generated against it.

Signed-off-by: Erik Sipsma <[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.

2 participants