Skip to content

chore: bump to go 1.27 - #14954

Closed
sipsma wants to merge 6 commits into
mainfrom
sipsma/go-1.27
Closed

sipsma wants to merge 6 commits into
mainfrom
sipsma/go-1.27

Conversation

@sipsma

@sipsma sipsma commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Dagger's own builds move to Go 1.27:

  • the engine and CLI;
  • golang:1.27-alpine, the image the engine uses to build Go SDK modules, so users' Go modules build with Go 1.27;
  • the base the golang module uses here for generation and tests;
  • the dev modules that pull a Go image.

Building dagger's CLI with the dagger/go module, with the engine and the compiles both on Go 1.27 against both on 1.26, a cold first build took 0.97 s less: 25.26 s against 26.07 s, median of 7 runs on one 16-CPU machine. Edits took 0.26–0.35 s less, and building a second binary took 2.2 s less. The engine's CPU and peak memory were unchanged.

Three commits:

  • golang.org/x/tools v0.47.0 → v0.50.0. Go 1.27 writes export data that x/tools before v0.50.0 cannot decode. Without this, every Go SDK module fails to load on an engine built with Go 1.27, because the SDK's codegen loads the module's packages through go/packages. moq in go generate fails the same way. The bump raises other golang.org/x modules to what it requires. go mod tidy also drops github.com/opencontainers/cgroups, which nothing imports.
  • The bump itself, in the places chore: bump to go 1.26  #11843 bumped to 1.26, plus the generation base.
  • Regenerated protobuf code. Go 1.27's gofmt drops an empty // line before indented comment lists. Its compress/flate encodes differently, so the gzipped descriptors have new bytes; decompressed, they are identical.

Three more commits, from what CI found on Go 1.27:

  • x/net's HTTP/2 deprecation. x/tools v0.50.0 needs golang.org/x/net v0.59.0, which deprecates its HTTP/2 client and server in favor of net/http's. Staticcheck's SA1019 is suppressed at those uses; behavior is unchanged.
  • estargz v0.19.0. v0.18.2 requires a 51-byte gzip footer; Go 1.27's compress/flate writes 48, so compressing a layer as eStargz panicked and took the engine down. v0.19.0 writes the footer itself. It needs klauspost/compress v1.20.1 and tar-split v0.12.3.
  • Host import patterns in one header value. Since Go 1.27, an HTTP/2 server accepts at most 500 header values per request by default, and closes the whole connection when a request over that spans several frames. The engine sent each include, exclude and follow-path pattern of a host read as its own header value, so a host directory read with more than about 500 patterns ended the session. The patterns now travel only in the single encoded options value, which CLIs have read first since Centralize GraphQL server in the Engine Runner #5415. TestHost/TestDirectoryManyPatterns covers it. A Go 1.27 CLI talking to an engine without this change still hits the limit.

go.mod stays at go 1.26.6 for now. The dev modules read it and are built with the Go of the engine that runs them. Released engines ship Go 1.26, which refuses a module that asks for 1.27. It can move once CI runs on an engine built from this change.

Go 1.27's compress/flate change also means data the engine gzips with Go's standard library can get different bytes, and so a different digest, for unchanged content.

Go 1.27's compiler writes package export data in a format (unified IR
version 5) that golang.org/x/tools before v0.50.0 cannot decode. Every
tool that loads type information through go/packages fails on it,
reading even the standard library ("internal error in importing
image/color (cannot decode ...)"). Here that is the Go SDK's codegen,
which loads a module's packages before it generates code for it, and
moq, which `go generate` runs in dagql/idtui.

v0.50.0 reads every earlier version as well, so this changes nothing on
Go 1.26. It raises x/crypto, x/mod, x/net, x/sync, x/sys, x/term and
x/text to what it requires; go mod tidy also drops
github.com/opencontainers/cgroups, which nothing imports. The dev
modules that build against the root module are tidied to match.

Signed-off-by: Erik Sipsma <[email protected]>
The engine and CLI are built with Go 1.27, the engine ships
golang:1.27-alpine for building Go SDK modules, and dagger/go's
generation and tests run on Wolfi's go-1.27. The dev modules that pull
a Go image take 1.27 as well.

go.mod's go directive stays at 1.26.6: dagger/dagger's own dev modules
read it and are built with the Go the running engine ships, which is
1.26 on every released engine, and that Go refuses a module that asks
for 1.27. It can move once CI runs on an engine built from this change.

Signed-off-by: Erik Sipsma <[email protected]>
protoc-gen-go is built with the generation base's Go, and Go 1.27
changes its output in two ways that don't change the code: gofmt no
longer keeps an empty "//" line before an indented list in a comment,
and compress/flate encodes differently, so the gzipped file descriptors
have new bytes for the same descriptors.

Signed-off-by: Erik Sipsma <[email protected]>
The x/tools bump needs golang.org/x/net v0.59.0, which deprecates
http2.Transport and http2.Server.ServeConn in favor of net/http's own
HTTP/2, so staticcheck reports SA1019 at each use. Behavior is
unchanged; moving the engine client off them is a change of its own.

Signed-off-by: Erik Sipsma <[email protected]>
estargz v0.18.2 requires the gzip footer it writes to be exactly 51
bytes. Go 1.27's compress/flate encodes it in 48, so compressing a layer
as eStargz panicked ("footer buffer = 48, not 51") and took the engine
down. v0.19.0 writes the footer itself (containerd/stargz-snapshotter

Signed-off-by: Erik Sipsma <[email protected]>
#2333). It requires klauspost/compress v1.20.1 and tar-split v0.12.3.
The engine sent a host import's include, exclude and follow-path
patterns twice: inside the single encoded options value, and again as
one gRPC header value per pattern. Since Go 1.27, an HTTP/2 server
accepts at most 500 header values per request by default, and when a
request over that limit spans several frames it closes the whole
connection. The CLI serves the session's attachables over that
connection, so reading a host directory with more than about 500
patterns ended the session ("http2: server connection error ...
PROTOCOL_ERROR", then "failed to sync").

Every CLI since #5415 reads the encoded value first, so the per-pattern
copies are dropped. Receiving them still works, for requests that come
straight from BuildKit.

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

sipsma commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Its commits moved into #15007, which now combines the engine's pending performance changes, to save CI runs.

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