Skip to content

Move the toolchain to Go 1.27 - #23

Merged
ichnograph merged 2 commits into
masterfrom
chore/go-1.27
Aug 24, 2026
Merged

Move the toolchain to Go 1.27#23
ichnograph merged 2 commits into
masterfrom
chore/go-1.27

Conversation

@ichnograph

Copy link
Copy Markdown
Contributor

Follows the 1.26.7 bump in 1.6.1.

The go directive in go.mod is what every workflow feeds to setup-go, so this moves both the language version and the standard library CI builds against. The Dockerfile builder image moves to golang:1.27.0 to match.

golangci-lint v2.12.2 to v2.13.1

Its modernize linter flagged twelve issues in the test suite:

  • Eleven embedded fields that can use the promoted-field shorthand in a composite literal.
  • One errors.As replaced with errors.AsType, which the 1.27 standard library adds. The tests therefore no longer build on 1.26.

The linter's own --fix produced invalid code in the MQTT writer tests. It hoisted promoted fields alongside the embedded field they belong to, which the compiler rejects (cannot specify promoted field Node and enclosing embedded field BaseDucoNodeStatus). Those two literals build the base value first instead.

Actions and dependencies

Every action was checked against its latest release. All nine were already pinned to the newest version by commit SHA, so none moved. go get -u ./... found no updates; the 1.6.1 sweep had already taken everything to latest.

Verification

Locally on go1.27.0: build, vet, full test suite, golangci-lint run at v2.13.1 (0 issues), and govulncheck ./... all clean.

Follows the 1.26.7 bump in 1.6.1. The go directive in go.mod is what
every workflow feeds to setup-go, so this moves the language version and
the standard library CI builds against. The Dockerfile builder image
moves to golang:1.27.0 to match.

golangci-lint moves to v2.13.1. Its modernize linter flagged twelve
issues in the test suite. Eleven are embedded fields that can use the
promoted-field shorthand in a composite literal. One replaces errors.As
with errors.AsType, which the 1.27 standard library adds, so the tests
now require 1.27 to build.

The linter's own autofix produced invalid code in the MQTT writer tests:
it hoisted promoted fields alongside the embedded field they belong to,
which the compiler rejects. Those two literals build the base value
first instead.

A dependency sweep found no updates. Every GitHub Action was checked
against its latest release and all were already pinned to the newest
version by commit SHA.
Default setup pins its own Go toolchain and runs the extractor with
GOTOOLCHAIN=local, so it failed on this branch with "go.mod requires go
>= 1.27.0 (running go 1.26.6)". It cannot build a module whose go
directive is newer than whatever the CodeQL bundle ships.

Driving CodeQL from a workflow lets setup-go install the toolchain go.mod
asks for before the build, so a Go bump no longer blocks code scanning.

Same languages and the same security-extended query suite as the default
setup it replaces. Default setup is now disabled on the repository.
@ichnograph
ichnograph merged commit b436775 into master Aug 24, 2026
8 of 9 checks passed
@ichnograph
ichnograph deleted the chore/go-1.27 branch August 24, 2026 09:13
ichnograph added a commit that referenced this pull request Aug 24, 2026
PR #23 merged while a CodeQL check was red. The red job was the old
default setup running autobuild, racing the API call that disabled it,
and our own manual-build job passed on the same commit. The conclusion
was right but the practice was wrong, and nothing stopped the merge:
master had no protection at all.

Master now requires lint, test and both CodeQL analyze jobs, must be up
to date before merge, and rejects force-pushes and deletion.
Administrators can still override for emergencies.

Two rules protection cannot enforce go in CONTRIBUTING: never merge on a
red check even when it looks stale, and confirm a fresh green run after
changing CI or scanning config, because those changes take minutes to
take effect on the GitHub side.

CI gains a workflow_dispatch trigger so it can be verified on demand, as
Security, Integration and now CodeQL already could. Release stays tag
driven.
ichnograph added a commit that referenced this pull request Aug 24, 2026
* Allow CodeQL to run on demand

The workflow only had push, pull_request and schedule triggers, so there
was no way to confirm a scanning config change was green without pushing
a commit to provoke one. That gap is why the switch away from default
setup was merged on a stale red check instead of a fresh green one.

* Protect master and write down the merging rules

PR #23 merged while a CodeQL check was red. The red job was the old
default setup running autobuild, racing the API call that disabled it,
and our own manual-build job passed on the same commit. The conclusion
was right but the practice was wrong, and nothing stopped the merge:
master had no protection at all.

Master now requires lint, test and both CodeQL analyze jobs, must be up
to date before merge, and rejects force-pushes and deletion.
Administrators can still override for emergencies.

Two rules protection cannot enforce go in CONTRIBUTING: never merge on a
red check even when it looks stale, and confirm a fresh green run after
changing CI or scanning config, because those changes take minutes to
take effect on the GitHub side.

CI gains a workflow_dispatch trigger so it can be verified on demand, as
Security, Integration and now CodeQL already could. Release stays tag
driven.

* Note that both CodeQL default setups are replaced

Settings has two independent default setups, Code security and Code
quality, and each spawns its own CodeQL run with its own pinned Go
toolchain. Both failed on Go 1.27 with the same autobuild error, which
made it look like one disable had not taken effect.

Record which runs come from where so the next person does not spend the
same time on it.

---------

Co-authored-by: Jeroen <ichnograph@users.noreply.github.com>
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