Skip to content

go: per-package builds that share module downloads and plans, with faster edits, lints and gobuild loads - #95

Merged
sipsma merged 81 commits into
mainfrom
sipsma/lint-export-data
Nov 9, 2026
Merged

sipsma merged 81 commits into
mainfrom
sipsma/lint-export-data

Conversation

@sipsma

@sipsma sipsma commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Builds with this module now compile each package on its own and share what they can across builds and projects: module downloads, build plans, and each package's export data. Edits rebuild less, a fresh engine loads gobuild without building it, and a module's archives are written in a format golangci-lint's export driver can serve, so a lint can load every package without compiling.

This PR now carries #97, #96 and #98, which it replaces, with its own export-data change and the per-package build's remaining commits. Each change keeps its own commits.

Per-package builds that share downloads and plans

  • Module downloads, once per version. Each module version a build needs is downloaded once, as its zip, verified against go.sum alone, and shared by every build that needs it. A module is packed from its zip without extracting it, after the same checks the go command makes, and a zip with a go.mod outside its root is refused.
  • Plans from what a build reads. A build plans from each downloaded module's Go headers and follows imports per package, from the package being built, through only the files that build for the target, including local and go.work replacements. A plan unpacks only the Go files it may read.
  • A plan is made again only when what it reads changes. The plan is keyed by a pack of the headers it reads, so an import change outside a module's build, in a nested module, an example or a tool, no longer re-plans it. Measured on a call after an import change in a nested module, 8 interleaved pairs: 3.92 s to 3.69 s (−0.24 s, 95% interval −0.27 to −0.21 s).
  • Archive builds return what they read. archiveBuilds returns a GoArchiveBuilds: each package build, each module download, gobuild's header tool, golangci-lint's write-manifest and its source, Go's pack tool and the includes helper, as the objects themselves rather than their IDs, so a cache can be filled with exactly those results and keeps them for as long as it keeps the call's result. An engine image can pre-warm them, so a run with that cache compiles none of the standard library or the SDK's constant dependencies and builds no tool. Before pack was among them, every run with assembly paid one 3.0 s go build cmd/pack.
  • Go 1.27, and images by digest. gobuild builds on Go 1.27, and its entrypoint names its images by digest, so a session doesn't look them up in the registry again.
  • gobuild's binary ahead of its first call. gobuild's generated entrypoint declares a prebuild member, which an engine that knows it evaluates before gobuild's first call. Other engines ignore it.

One source read per build, huge pages, smaller unpacks (from #97)

  • An edit's build reads the workspace from the client once instead of twice: −0.26 to −0.32 s per edit.
  • Compiles and links ask for transparent huge pages: −2.8 s on a cold build on a host whose huge pages are set to "always"; elsewhere it changes nothing.
  • Dependency modules unpack without their tests and testdata: about half the files and 0.35 GB of the 1.26 GB unpacked, and 0.9 s less engine CPU on a cold build.
  • An unlisted local replace with an absent target no longer fails the workspace scan. go build reads a replacement only for a module the build needs; a replace of a required module with an absent target still fails the scan.
  • gobuild needs engine v1.0.0-beta.24, the first release with File.extract's include and exclude patterns. The first build after upgrading recompiles everything once.

Importers keyed on export data, and archives for golangci-lint

Each package compiles its export data apart from its object code, so its importers rebuild only when its exported API changes. Building dagger's CLI from a fresh engine, 10 interleaved runs each:

Build Before After Change
Edit inside an internal package 7.79 s 5.04 s 2.75 s faster
Edit to the CLI's own package 6.31 s 6.42 s 0.10 s slower
Rebuild with no change 1.44 s 1.46 to 1.52 s 0.02 to 0.08 s slower
First build 25.25 s 25.32 s no measurable difference

GoModule.archives returns each package's export data, the Go files cgo wrote, and a manifest keyed by package ID, in a format golangci-lint's export driver can serve, so that driver can load every package without compiling or running cgo. The manifest is written by dagger/golangci-lint's write-manifest, built from a pinned commit of dagger/golangci-lint, so gobuild keeps no copy of the format or of the digest the driver checks each archive with. A fresh engine fetches that source from GitHub on first use, unless its image ships it. No released golangci-lint module reads this format yet: the published driver declines it, so lints don't get faster from this PR alone. The lint speedup follows when dagger/golangci-lint's matching change ships. With that change, on dagger's root module, a lint with an empty cache went from 97–103 s to 21–24 s with the same findings. archives(dependencies: true) returns the standard library's and other modules' archives alone, keyed by their content.

gobuild on the Go SDK's Dang entrypoint (from #96)

A fresh engine reads gobuild's types from its generated Dang entrypoint instead of building and running gobuild's Go code to ask for them. Listing dagger/dagger's 4,951 tests on a fresh engine: 13.09 s to 8.97 s (4.20 s faster); unchanged and after an edit on a warm engine, within a few hundredths of a second. gobuild's API is unchanged, and the generated entrypoint needs v1.0.0-beta.18 or later.

The workspace installs go-sdk at dagger/go-sdk#100's head, which adds the entrypoint's prebuild and runtimeImage members and names its images by the tag generation asks for with their digest, and gobuild's generated files come from it. Once #100 merges, the pin moves to its merged commit.

Tests that -failfast stopped fail, and only packages with selected tests run (from #98)

  • With -failfast in goflags, the selected tests a failure stopped used to pass. They now fail as "did not run", so one failure shows as one red check for it and one for each test it stopped.
  • When nothing was selected out of a module, its test command ran ./..., so a failing package without selected tests failed every selected test with it. The command now names only the packages that hold selected tests.

Faster check -l --all listings

Fixes in the build

  • A package's step is titled by its package, not by its whole build script, which for a failed compile could be one line of over 46,000 characters. Every package step's cache key changes once.
  • A module that GONOPROXY names, or GOPRIVATE when GONOPROXY is unset, downloads in the caller's container with its credentials, as the go command decides; before, GOPRIVATE was read first.
  • pack is built ahead of the build only on Go 1.25 and later, which run it; builds on Go 1.24 and earlier no longer build it.
  • A failed read in a build's setup (the downloads container's mounts, the starting module cache's checksums, whether the go command switched toolchains) fails the build instead of changing it.
  • gobuild's header tool is built in the Go image gomod pins, the one definition of that image, once per build; a module's scan runs the same includes helper the library builds.
  • go-dev's selected-test checks read both the flat and the grouped dagger check report layout, so they pass on engines with and without feat(telemetry): group collection checks in uploaded runs dagger#15088, which nests a collection's items under one parent check.

Testing

  • The go-dev checks pass, among them gobuild-check (with TestHdrToolSubset and TestExcludeUnread), plan-reuse-check, which fails without the plan keying, the archive and download checks, and selected-failfast-check.
  • go-sdk/generate/stale passes: gobuild's generated files are what go: generate Go 1.27 modules, and build entrypoint modules with dagger/go's per-package build go-sdk#100's head generates.
  • archives-check lints its fixture with golangci-lint at that commit, reading export data from the archives, and fails unless the export driver serves every package from them; with golangci-lint's current main it fails with the driver declining the manifest's version. toolchain-switch-check also checks that a switched module's manifest records the Go it switched to.
  • New checks: pack-tool-check (a build on Go 1.24 builds no pack, one on Go 1.27 builds it once) and no-proxy-downloads-check (a module only GONOPROXY names downloads with the caller's git configuration); each fails without its change.
  • The workspace scan's new test, TestUnusedReplaceOfAbsentTargetIsIgnored, fails without its change.

sipsma added 29 commits November 4, 2026 23:20
v1.0.0-beta.24 is the first release with File.extract's include and
exclude patterns, which unpacking a module without its tests needs. The
regenerated client also brings withExec's transparentHugePages, and the
Go SDK's one-request dispatch: a function call's name, parent and
arguments are read in one request instead of one per value.

Signed-off-by: Erik Sipsma <[email protected]>
The compiler's heap grows into fresh memory, and on a host set to "always"
huge pages save a cold build most of its page faults (2.8 s of dagger's CLI
first build on a 16-core Graviton4). Elsewhere it changes nothing.

Signed-off-by: Erik Sipsma <[email protected]>
Each build read the workspace from the client twice, one read after the
other: once for the scan, with every Go file and go.mod, and again for
the module's source, with the patterns the scan worked out. Both
patterns match at any depth, so each read walked the client's whole
tree.

The scan now reads every file a Go build can need whose name alone picks
it out (goSource), and a module's source reuses that read, which the
engine answers from its session cache. The source reads again only the
patterns goSource doesn't cover, such as embedded files, and those name
the directories they are in, so that read skips the rest of the tree.

Signed-off-by: Erik Sipsma <[email protected]>
A "!" pattern takes back files the patterns before it selected. Split
across the shared Go source read and the read of the rest, it applied
only to the rest, so a Go file it excluded stayed in the source. A source
whose patterns hold one is read in one read of the whole list, in order,
as before.

Signed-off-by: Erik Sipsma <[email protected]>
Dagger cleans a pattern's path before it looks for a leading "!", so
"./!a.go" excludes a.go, but it doesn't start with one. A source whose
patterns hold a "!" anywhere is now read in one read, as before.

Signed-off-by: Erik Sipsma <[email protected]>
A build of a dependency never reads its test files or its testdata
directories, which the go command ignores, and in some modules they are
most of the files. Each module is now extracted without them, through
File.extract's exclude patterns, which leave those entries of the zip
undecompressed. For dagger's CLI that is about half the files and
0.35 GB of the 1.26 GB unpacked.

What the build plan does read from them is put back: a dependency's
tests that go test -c compiles, and files a package embeds from
testdata. A module none of those come from, nearly every one, extracts
the same in every build, so its packages' cache keys stay shared across
projects.

Signed-off-by: Erik Sipsma <[email protected]>
A package with C or assembly reads its whole module, which its includes
can reach anywhere in, testdata included, without the plan naming the
file. Such a module was still extracted without its tests and testdata,
so an include from testdata failed. It is now extracted whole, exactly
as before the exclusions. A directory read whole, where cgo runs, is put
back whole too.

The exclusions now match only under the module's own directory in the
zip, so a module path with a "testdata" element no longer matches them,
and a file in a directory named like a test file is put back when the
build reads it.

Signed-off-by: Erik Sipsma <[email protected]>
golangci-lint's export driver compiled every test variant of a module's
packages inside the lint, as go list -export would: the module's test
packages, and the packages recompiled against them, such as core for
dagql's tests. At dagger's scale that was about 28 s of the root lint, and
listing compiled files ran cgo for every cgo package, about 12 s more with
an empty build cache.

GoModule.archives now compiles what go list -export -deps -test compiles:
its plan comes from go list -export -n, whose steps the helper names by
their package's ID, a test variant by its test files and a recompiled
package by its imports, leaving out the test mains. Each variant compiles in
an exec of its own, as a test binary's packages do. The archives carry the
Go files cgo wrote for each cgo package, and the manifest, now version 2,
lists every package by its ID with its cgo files and that output, so the
driver can give golangci-lint each package's compiled files without
running cgo. A cgo package's digest covers its cgo files too.

Signed-off-by: Erik Sipsma <[email protected]>
A package's archive held its export data and its object code, and each
importer's exec mounted its imports' whole archives, so an edit that only
moved lines re-ran every importer: the object code carries line numbers,
also through what importers inline. In dagger's root module, an edit that
moves the lines of one file changes the export data of that package alone,
but the object code of eight, core among them, which most of dagger imports.

Each package now compiles with -linkobj: its output is its export data,
which its importers' compiles read, and its object code goes to a second
archive, which its pack steps add to and which only a link reads, from
/work/linklib. An edit that leaves a package's export data as it was leaves
its importers cached. A main package that links in its own exec, and a
gccgo compile, still write one archive. The archives a lint reads are export
data only: 168 of the 2,240 MB at dagger's scale.

Signed-off-by: Erik Sipsma <[email protected]>
The export driver gives golangci-lint each cgo package's compiled files
from the archives' copy of cgo's output, instead of running cgo. That
output depends on the C settings as well as the sources: the manifest now
records the go command's C settings and the first line the C compiler
prints for --version, for the driver to compare with its own.

Signed-off-by: Erik Sipsma <[email protected]>
go test compiles a main package with tests a second time, as a library
named by its import path, even when only its external tests need it and the
variant reads no test files. The archives named that variant as the plain
package, so the two shared an ID and an archive. A main package's step that
doesn't compile it as main is now its test variant.

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

With -buildmode=plugin, go compiles a main package as a library, so it
isn't told from its test variant by how it compiles: of a main package's
two steps, the one compiled as main, or else the first, is the plain
package, and one alone is plain.

A cgo package's entry also records the module version its files come from,
for the export driver to use the archives' cgo output only with the same.

Signed-off-by: Erik Sipsma <[email protected]>
…om the cache

Plan step numbers have at least three digits, so "b1000" sorted before
"b999" as text: steps are ordered by their number. And a cgo package's
entry names its module version only when its files are in the module
cache, not a copy such as a vendor directory's.

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

Every package step read its link object before it freed its slot and let
its importers start, though only the link reads it: about 15–24 ms of
engine time per package, on every hop of the chain. A step now reads it
after, in the background, and only in a walk that links; the link waits
for them, by when they have long finished.

The link's own compile reads only its imports' export data, so it mounts
those, not every dependency's: a gather of some 1,400 files at the end of
the chain, at dagger's scale, left out.

Signed-off-by: Erik Sipsma <[email protected]>
The archives of a module's lint change with any edit of its own packages:
their manifest and their own packages' archives do. golangci-lint's
analysis of the dependencies, their facts, can be one result for a set of
dependencies only if what it reads stays the same across such an edit.

GoModule.archives(dependencies: true) returns the archives of the packages
of other modules and the standard library alone, and the manifest is read
from its exec's evaluated output, so the directory is keyed by its content.

gobuild's committed client is regenerated for the new argument, and with it
Archives' description from the commits before.

Signed-off-by: Erik Sipsma <[email protected]>
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]>
With -failfast, go test stops a package at its first failing test, and
the selected tests after it have no events in the report. The helper
passed them, so one failure showed as a single red check among green
ones that never ran. A test the binary left out of a failing package
passed the same way.

Such a test now fails, saying go test failed its package without
running it, as a selected test absent from a passing package already
does. One failure under -failfast now shows as one red check for the
failing test and one for each selected test it stopped.

Signed-off-by: Erik Sipsma <[email protected]>
With nothing selected out, a module's test command ran ./..., so it
also ran the module's packages that hold no selected test. When one of
them failed, such as a package of test helpers that fails to build or
whose TestMain fails, every selected test in the module failed with it,
however unrelated.

The command now names only the packages that hold selected tests, as a
partial selection already did. A failing package without any is not
run and fails no check. The helper's report of failures in packages
without selected test checks can no longer happen and is gone.

The packages come in discovery's byte order, so the command is stable
without the sort a partial selection did on every check.

Signed-off-by: Erik Sipsma <[email protected]>
Several of the changes before this one each regenerated gobuild for
themselves; this is one dagger generate over all of them together.

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

With -failfast, go test starts no further test binary once a package
fails: a package that has not started yet returns without output, so
the report has no event for it at all. Its selected tests failed as
"no successful result", and which packages that hit depended on
whether each had started before the failure.

They now fail as "did not run", saying go test stopped before starting
their package after a failure. selected-failfast-check no longer
selects the second package of the failing module, whose result
depended on that timing, so its totals are the same on every run.

Signed-off-by: Erik Sipsma <[email protected]>
A build's module cache was one go mod download per project, keyed by its
go.mod and go.sum files, so every Go module of a workspace downloaded its
whole dependency tree again. Each module version a build's go.sums name is
now its own download, keyed by its path, version and checksums, checked
against go.sum, and shared by every project and caller that reads it; the
module cache is assembled from them, and the plan still verifies it against
go.sum. A public module downloads in the toolchain alone, with only the
environment that decides a download; a private one, by GOPRIVATE or
GONOPROXY, in the caller's own container with its credentials. A project
whose go.mod switches toolchains downloads as before, with that toolchain.

Signed-off-by: Erik Sipsma <[email protected]>
Merged one by one, a build's hundreds of module downloads stacked a layer
each, past what an overlay mount takes. One exec copies them into the module
cache instead, and each download keeps only its cache/download files: the plan
extracts what it reads from the zips, as the go command does, and a build
reads each module extracted on its own.

Signed-off-by: Erik Sipsma <[email protected]>
A go.sum records the go.mod of every version the module graph looked at, and
each was its own download exec: 578 of them in one fresh listing of dagger's
modules, beside 195 zips. With graph pruning the plan loads few, and fetches
those itself. Downloads run 32 at a time, as they wait on the network, and the
pack tool, which every build compiling the runtime waits for, is built
alongside the plan.

Signed-off-by: Erik Sipsma <[email protected]>
With downloads left unextracted, every plan extracted the zips it read: 1.44 s
against 0.32 s for go build -n of dagger/alpine. Each module's download now
also writes its plan pack (gohdr packmod): its Go files' headers, its other
files whole but tests and testdata, and its go.mod, info and checksum, as a
plan reads of a module. A build's packs are gathered in one step and the plan
unpacks them into its module cache; the compiles read each module from its
own zip, and Archives' manifest from the modules as the compiles read them.

Signed-off-by: Erik Sipsma <[email protected]>
Every zip a go.sum names was downloaded before the plan, and the plan waited
for the slowest: for dagger/alpine, google.golang.org/api, 3.6 to 6.6 s, which
its binary never compiles; a go.sum names the zips of what any package and
test of the module reads. The downloads now start from the modules that
provide the source's imports and, as each finishes, go on to those that
provide the module's own imports, from its pack (gohdr packmod writes them;
gohdr imports reads the source's), until no new one turns up: what the
build's packages import, whatever their build constraints, but no test's. A
module the plan reads that this misses, such as one a replace renames, the
plan fetches itself and the build downloads on its own.

gohdr's own toolchain image is pinned by digest: its tag moves, a workspace's
lockfile may pin it to another digest, and every plan and download mounts
gohdr, so a different gohdr is a different key for all of them.

Signed-off-by: Erik Sipsma <[email protected]>
Following every package of a downloaded module still downloaded what the
build never reads: apko's GCP packages brought google.golang.org/api into
dagger/alpine's build. A module's pack now lists each of its packages'
imports, and discover follows only the packages the build imports, as the go
command's loader does, whatever their build constraints select.

Signed-off-by: Erik Sipsma <[email protected]>
The source's imports, all of them, still seeded the downloads: a module from
a git repository brings the whole repository, and its tests and other
packages brought google.golang.org/api into dagger/alpine's build. gohdr
imports now lists each source package's imports and the source's module
paths, and the build follows them from the package it builds through the
source's own packages, as the loader does; a test build or Archives seeds
from every package, tests included.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added 13 commits November 5, 2026 21:51
A package's exec ran its script inline, as `sh -c '<script>'`, so the
script was the exec's arguments and its title wherever the build is
shown. When a module fails to compile, the step over the compile error
was titled with the whole script: for the Go SDK's runtime of a small
module, a single line of 46,376 characters, mostly the link's import
config. The engine and every client that renders the trace also hold
that text for every package step.

The script is now mounted read-only as a file built from its contents,
and the exec runs `sh /gobuild/build.sh <importpath>`. The title names
the package. A mounted file adds no layer to the step's root filesystem,
which a WithNewFile per step would. Steps with the same script still
share, since the mounted file's key is its content. Scripts over the
kernel's argument limit already went in as a file; they now go the same
way as the rest.

Every package step's cache key changes once.

Signed-off-by: Erik Sipsma <[email protected]>
go-sdk's pull request carries Go 1.27 and the per-package build's go-sdk
side, which gobuild's entrypoint is generated with.

Signed-off-by: Erik Sipsma <[email protected]>
archiveBuilds returned the IDs of what a module's archives read from the
cache, as strings. A cached result of it held handles the cache knew
nothing of: the results they named were kept by nothing, and a later
session, such as an engine image's entries made again on the same state,
could be handed a handle to a result the cache had already dropped.

It now returns them as they are, a GoArchiveBuilds of the package builds
and the module downloads, each in the order it had, gohdr, pack's
directory and the includes helper, which the cache keeps for as long as
it keeps the result. A caller takes each one's ID in its own session.

The builds and downloads come from gobuild as lists of objects, which
Dang makes a list by a selection on each: their sync, which gives back
the object itself.

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

Two steps that don't wait on anything, the plan's filtered source and
each package's selection of source files, were started early by asking
for their IDs and dropping them. sync is the call that evaluates a
result: they're synced instead. A package keeps the synced directory,
which carries its ID, so its exec still doesn't ask for it in the
package's slot, as module directories already do.

Cache keys don't change: sync returns the same ID.

Signed-off-by: Erik Sipsma <[email protected]>
GoMod.scanned built the go-includes helper from its own copy of
Gomod.includesHelper's container chain. The two shared a cache entry only
while they stayed byte-for-byte the same, and an edit to either would have
left a cache that pre-warms includesHelper without the helper every module's
scan runs. scanned now reads includesHelper, in place of the goImage call the
copy made, so it makes no more module calls than before.

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

The go command fetches a module directly, not through a proxy, when
GONOPROXY names it, or GOPRIVATE when GONOPROXY is unset. gobuild read
GOPRIVATE first, so with both set, a module only GONOPROXY named
downloaded in the toolchain container, without the caller's git
configuration or SSH agent, and failed to authenticate where go build in
the caller's container succeeds. gobuild now reads them in the go
command's order.

Signed-off-by: Erik Sipsma <[email protected]>
Go 1.25 and later run "go tool pack" for each package with assembly, the
runtime among them, so a build on them waits for pack: it was built
alongside the plan for every build, and started a second time before the
walk. Go 1.24 and earlier run the toolchain's own pack, and the build of
pack was wasted there. It now starts once, alongside the plan, when the
build's toolchain is Go 1.25 or later. A package that runs pack still
mounts it whatever the version, so a toolchain whose version doesn't parse
builds pack where the package needs it.

Signed-off-by: Erik Sipsma <[email protected]>
gomod's goImage and gobuild's toolImage each wrote the Go 1.27 image's
digest by hand, with a comment that it must be the other's, and nothing
checked that they agreed. Had one moved alone, a build would pull two Go
images and an engine image would pre-warm the wrong one.

gomod is now the one place the digest is written: golangci-lint and
staticcheck use it without gobuild. gobuild takes the image as its
constructor's toolImage, and go passes it gomod.goImage of
gomod.scannerVersion, as it already passes each build's own image from
goImage. Each build makes its gohdr once, in that image, and its steps
that run gohdr alone run there too.

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

Three errors were dropped: the downloads container's mounts, the start
cache's checksums, and whether the go command switched toolchains. With
the first, the downloads container kept the Go cache volumes it is meant
to lose. With the second, a toolchain the go command switched to lost
its checksums, so its module was mounted file by file instead of as a
module directory. With the third, a switched build was taken as
unswitched and downloaded per module from go.sum entries for a
toolchain the go command didn't use. Each is now returned.

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

The workspace pins go-sdk at its pull request's new head. Regenerating
gobuild with it names the entrypoint's images by the tag generation asks
for, so the generated file no longer depends on which tag of the same
image the engine resolved first, and adds the entrypoint's runtimeImage
member, which the call's container now starts from.

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

Archives wrote manifest.json with gohdr's own copy of the format and of
the digest golangci-lint's export driver checks each archive with, which
could drift from the driver's. dagger/golangci-lint now has them once, in
a module beside the driver that needs only the standard library, with a
write-manifest command. Archives builds that command from a pinned commit,
as it builds gohdr, and gohdr's manifest goes.

The settings the manifest records are the go command's where the plan ran
it, toolchain switch included: write-manifest env prints them in the plan's
container as the plan left it, which the plan's own go env call did before,
from a list of settings gobuild no longer keeps. toolchainSwitchCheck now
also checks that a switched module's archives are that Go's.

Archive builds return write-manifest and the source it is built from,
beside gohdr, so that an engine image can ship both and a fresh engine
neither fetches the source nor builds the command.

Signed-off-by: Erik Sipsma <[email protected]>
archivesCheck checked the archives with archivescheck, a copy of the export
driver's digest, which can't tell when the archives and the driver
disagree. It now lints the fixture with golangci-lint at a pinned commit,
reading export data from the archives, and wants the driver to serve every
package from them: none declined, compiled, listed by the go command or
missing. The archives are built in the lint's own image, so the driver
finds the C settings cgo's output was made with.

Signed-off-by: Erik Sipsma <[email protected]>
…ators any Go

dagger/golangci-lint's export driver now serves a caller that reads
declarations only, such as the Go SDK's codegen, whatever its module's Go
language version. The manifest module write-manifest is built from is
unchanged, so the archives are too; the pin moves with the driver's so
that both name one commit.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma requested a review from grouville November 7, 2026 00:47
With a custom base, discovery ran go env in the base to learn its Go
version, cgo and GOFLAGS, so a listing built the whole image first. On
dagger/dagger that is about 8 s of a fresh `check -l --all`, after the
base itself is resolved.

GOFLAGS, and cgo when CGO_ENABLED is 0 or 1, now come from the base's
environment, which reading doesn't build. The scan records whether any test
file with tests has a constraint naming a Go release or cgo, read from the
comments before its package clause as go/build reads them. Only then
(for cgo, only when CGO_ENABLED isn't 0 or 1) does discovery still ask the
base's go: it alone knows its version, and whether cgo is on otherwise. A
base that sets GOFLAGS only in a Go environment file, not in its
environment, is listed without those flags.

Signed-off-by: Erik Sipsma <[email protected]>
Each module's package listing globbed the workspace for every generate
pattern to find the directories go generate may run in. The answer is the
same for every module, and on a host checkout each glob is a walk by the
client: dagger/dagger's 5 patterns made 410 walks per listing, about 3 s of
every warm `check -l --all`. The globbing is now gomod's goFileDirectories,
a call every module's listing makes with the same arguments, so the engine
runs it once per listing. The glob syntax stays the engine's.

Signed-off-by: Erik Sipsma <[email protected]>
Since dagger/dagger#15088, `dagger check` reports a collection's items
under one check: the report's top CHECKS header counts the collection
once, and the items' totals move to the CHECKS header nested under it.
The selected-test checks compared the top header with the items'
totals, so 11 of them failed on an engine with that change even though
every item reported the expected result.

Accept both layouts: the released engines' flat report, whose one top
header tallies the items, and the grouped one, whose top header shows
one collection check, passed only when every item passed, with exactly
one header nested under it that tallies the items.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma merged commit a4df0c1 into main Nov 9, 2026
91 checks passed
eunomie pushed a commit to eunomie/dagger that referenced this pull request Nov 10, 2026
The workspace's golang module moves to the merge of dagger/go#95, which
lists a custom base's tests without building the base and globs the
generate patterns once per listing, not once per Go module.

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