Repository navigation
chore(go): build with Go 1.27.1 and clear the lint backlog it surfaces - #422
Open
markussiebert wants to merge 1 commit into
Open
markussiebert wants to merge 1 commit into
markussiebert wants to merge 1 commit into
Conversation
markussiebert
force-pushed
the
renovate/major-all-major
branch
from
October 9, 2026 09:19
6b549e0 to
91b340c
Compare
markussiebert
force-pushed
the
chore/go-1.27
branch
from
October 9, 2026 09:23
72889c2 to
71cb73a
Compare
markussiebert
force-pushed
the
renovate/major-all-major
branch
from
October 9, 2026 11:25
91b340c to
9949a42
Compare
Set the toolchain directive to go1.27.1 in both modules while leaving the go
directive on the language version 1.27.0, so every build uses the patch release
without raising the minimum for consumers. CI and the promote workflow pin the
same 1.27.1.
Raising the go directive forces a golangci-lint built with Go >= the target,
because golangci-lint refuses to run otherwise. The previous pins were built
with go1.26.x, so both move to 2.14.0 (built with go1.27.0). The Makefile and
the workflow pinned different versions before; they now agree.
That newer staticcheck surfaces three things:
- Three existing SA1019 exclusions stopped matching, because staticcheck now
reports deprecations fully qualified: "SA1019: mgr.GetEventRecorderFor"
became "SA1019: (sigs.k8s.io/controller-runtime.Manager).GetEventRecorderFor".
The patterns are relaxed to match either form; the intent is unchanged.
- Deprecated struct fields are now detected where they were not before. The
Project API still exposes those fields, so the client has to keep reading
and sending them; the affected lines get the same //nolint:staticcheck the
surrounding code already uses. Dropping the fields is an API change,
tracked in #242.
- client-go v3 deprecates gitlab.Ptr in favour of new(), which Go 1.26 opened
up to value expressions, and annotates it with //go:fix inline. govet
reported all 55 call sites because it cannot apply the fix itself. They are
rewritten to new() via gofmt -r, which also let one pointless
*gitlab.Ptr(x) deref collapse to x.
Ten directives are dropped rather than added. client-go v3.16.2 removed the
incorrect "No longer supported in recent versions." annotations from
CIForwardDeploymentEnabled, IssuesTemplate, MergeRequestsTemplate and
ServiceDeskEnabled, so the suppressions on those call sites no longer suppress
anything. nolintlint is enabled without allow-unused and reports them, which
would fail the lint gate.
Go 1.27 also changed gofmt's struct literal alignment, so the two files that
differ are reformatted and the generated cluster-scope mirrors follow. The
generated settings converters pick up the rate limit fields v3.17.0 added to
UpdateSettingsOptions.
golangci-lint 2.14.0 reports no issues, go build and go test pass, and make
generate leaves the tree clean.
Assisted-by: Kiro:claude-opus-5
Signed-off-by: Markus Siebert <markus.siebert@deutschebahn.com>
markussiebert
force-pushed
the
chore/go-1.27
branch
from
October 9, 2026 13:44
71cb73a to
a7ee2fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Stacked on #410 — review that one first.
Builds with Go 1.27.1 and clears the lint findings that come with it.
The
toolchaindirective moves togo1.27.1in both modules while thegodirectivestays on the language version
1.27.0, so every build uses the patch release withoutraising the minimum for consumers. CI and the promote workflow pin the same
1.27.1.Raising the
godirective forces a golangci-lint built with Go >= the target, becausegolangci-lint refuses to run otherwise. The previous pins were built with
go1.26.x, soboth move to
2.14.0, built withgo1.27.0. The Makefile and the workflow pinneddifferent versions before; they now agree.
That newer staticcheck changes three things.
Three existing
SA1019exclusions stopped matching, because deprecations are now reportedfully qualified:
SA1019: mgr.GetEventRecorderForbecameSA1019: (sigs.k8s.io/controller-runtime.Manager).GetEventRecorderFor. The patterns arerelaxed to match either form, the intent is unchanged.
Deprecated struct fields are detected where they were not before. The
ProjectAPI stillexposes those fields and the client has to keep reading and sending them, so the affected
lines get the same
//nolint:staticcheckthe surrounding code already uses. Dropping thefields is an API change, tracked in #242.
client-go v3 deprecates
gitlab.Ptrin favour ofnew(), which Go 1.26 opened up tovalue expressions, and annotates it with
//go:fix inline. govet reported all 55 callsites because it cannot apply the fix itself; they are rewritten with
gofmt -r, whichalso let one pointless
*gitlab.Ptr(x)deref collapse tox.Ten directives are dropped rather than added. client-go v3.16.2, which #410 picks up,
removed the incorrect "No longer supported in recent versions." annotations from
CIForwardDeploymentEnabled,IssuesTemplate,MergeRequestsTemplateandServiceDeskEnabled, so the suppressions on those call sites no longer suppress anything.nolintlintruns withoutallow-unusedand reports them, which would fail the lint gate.A note on the suppressions
This adds a lot of
//nolint:staticcheck, and they are not all equal. Behind the 73hand-maintained directives in
pkgandapisare 73 real SA1019 findings —nolintlintconfirms none is unused — but they fall into three groups: fields this API deprecated
itself and still has to serve, client-go fields with a genuine replacement that we have
not migrated to yet, and client-go annotations that were simply wrong.
The third group is shrinking on its own: the ten removed here, plus the container
expiration policy ones resolved in #410, all came from
client-go#2303.
Worth saying plainly: one of the directives this change originally added was a true
positive. It sat on a line writing
ContainerExpirationPolicyAttributes.NameRegex, whichclient-go overwrote before encoding, and silencing it is how the regression in #418 got
in. Bulk-suppressing a backlog can bury real findings, so the remaining ones deserve to be
read individually rather than waved through.
Follow-up, not in this PR
The migrations that would actually reduce the second group:
tagList→topics,packagesEnabled→packageRegistryAccessLevel(replacement added in #419),emailsDisabled→emailsEnabled,markedForDeletionAt→markedForDeletionOn.How has this code been tested
golangci-lint 2.14.0 reports 0 issues,
go build ./...andgo test ./...pass, andmake generateleaves the tree clean, socheck-diffis reproducible. The lint gate runsin CI for this branch, which is the point of the version bump.
I have:
make generateandgolangci-lintto ensure this PR is ready for review.