Skip to content

fix(all): lower the minimum Go version to 1.26.9 - #261

Merged
jochumdev merged 1 commit into
lxc:mainfrom
tallica:fix/loosen-go-version
Nov 15, 2026
Merged

jochumdev merged 1 commit into
lxc:mainfrom
tallica:fix/loosen-go-version

Conversation

@tallica

@tallica tallica commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #258

As requested in #258, this splits the Go version we build with from the minimum we support:

  • Minimum: go.mod now declares go 1.26.9, the same minimum as Incus. It is also the highest version any of our dependencies require (lxc/incus/v7, pires/go-proxyproto).
  • Tested and released against: the latest 1.27.x. The workflows now use go-version: "1.27.x" with check-latest: true instead of go-version-file: go.mod.

What had to change

  • Tests: Go 1.27 allows setting fields from an embedded struct directly in a struct literal, e.g. types.ServiceConfig{Image: ...}. The go line in go.mod sets the language version, so with go 1.26.9 those literals stop compiling on any Go version, 1.27.x included. The affected tests now name the embedded struct explicitly (ContainerSpec: types.ContainerSpec{...}, WorkloadSpec, and Incus' InstancePut). This only touches test files; the non-test code already built at 1.26.
  • GOTOOLCHAIN: the workflows set GOTOOLCHAIN: go1.27.0+auto. With the lower go.mod, that would make every build switch to Go 1.27.0 and ignore the 1.27.x installed by setup-go. It is now GOTOOLCHAIN: local, so builds use exactly the Go that setup-go installed.

Minimum version build

A new workflow, test-min-go.yml, installs the version from go.mod (1.26.9) with GOTOOLCHAIN: local and runs:

  • go build ./...
  • go vet ./... with and without the e2e tag; this catches standard-library APIs newer than the minimum
  • a compile-only go test -run '^$', with and without the e2e tag, since most tests need a live Incus server

I ran the same steps locally with Go 1.26.9 and they pass.

Match Incus' minimum so distro packagers don't need the newest Go.
Releases and CI still build with the latest 1.27.x; a new job checks
the minimum.

Closes lxc#258

Signed-off-by: Michał Lipski <michal@tallica.pl>
@tallica
tallica requested a review from jochumdev November 14, 2026 21:27
@jochumdev
jochumdev merged commit b99b0c5 into lxc:main Nov 15, 2026
9 checks passed
@jochumdev

Copy link
Copy Markdown
Member

Thank you!

@tallica
tallica deleted the fix/loosen-go-version branch November 15, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Minimal go version

2 participants