Skip to content

fix(lint): migrate golangci-lint config to v2 (required by Go 1.25 bump) - #74

Merged
mridulgain merged 2 commits into
mg/fix-trivy-ci-install-failurefrom
mg/fix-golangci-lint-v2-migration
Aug 19, 2026
Merged

fix(lint): migrate golangci-lint config to v2 (required by Go 1.25 bump)#74
mridulgain merged 2 commits into
mg/fix-trivy-ci-install-failurefrom
mg/fix-golangci-lint-v2-migration

Conversation

@mridulgain

@mridulgain mridulgain commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Stacked on #73 — depends on its Go 1.25 bump.

  • Once chore(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures #73 bumps go.mod's go directive to 1.25.0 (needed for the grpc CVE fix), the Lint CI job starts failing:
    golangci-lint has version 1.64.5 built with go1.24.0
    Error: can't load config: the Go language version (go1.24) used to build golangci-lint is lower than the targeted Go version (1.25.0)
    
  • golangci-lint's v1 line is discontinued — there's no newer v1.x build to pin instead. Migrated to v2.11.0:
    • Ran golangci-lint migrate to convert .golangci.yml to the v2 schema. gosimple/stylecheck are now folded into v2's staticcheck meta-linter (same checks, no intended behavior change).
    • Bumped Makefile's GOLANGCI_VERSION to 2.11.0.

Test plan

🤖 Generated with Claude Code

mridulgain and others added 2 commits August 19, 2026 11:28
golangci-lint v1.64.5 (pinned in Makefile) was built with Go 1.24 and
refuses to lint a module targeting a newer Go version:

  Error: can't load config: the Go language version (go1.24) used to
  build golangci-lint is lower than the targeted Go version (1.25.0)

This became a hard failure once go.mod's go directive was bumped to
1.25.0 (see the grpc CVE fix on the parent branch). golangci-lint's
v1 line is discontinued, so there is no newer v1.x build to pin
instead — migrated to v2.12.2.

- Ran `golangci-lint migrate` to convert .golangci.yml to the v2
  schema. gosimple/stylecheck are now folded into v2's staticcheck
  meta-linter (same checks, no behavior change intended).
- Bumped Makefile's GOLANGCI_VERSION to 2.12.2.
- Fixed the new findings the newer staticcheck/prealloc checks
  surfaced, all pre-existing and mechanical:
  - Removed embedded-field redundancy (`x.Embedded.Field` ->
    `x.Field`) in server/oauth2.go, server/rotation.go, and several
    storage/kubernetes files.
  - Converted an equality-chain switch to a tagged switch in
    server/oauth2.go.
  - Preallocated a slice with known capacity in
    storage/conformance/conformance.go.
  - Removed two `//nolint:prealloc` directives in
    connector/keystone/keystone.go that prealloc no longer flags.
  - Simplified `c.Config.Field` to `c.Field` in
    connector/atlassiancrowd/atlassiancrowd_test.go (embedded Config).

Verified: `golangci-lint run` reports 0 issues; go build/vet/test
pass (the one remaining test failure is the pre-existing,
unrelated SAML fixture-cert-expiry issue fixed on a separate branch,
PR #72).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…roken

CI failed installing golangci-lint v2.12.2:

  err hash_sha256_verify checksum for '.../golangci-lint-2.12.2-linux-amd64.tar.gz' did not verify
  8df580d2670fed8fa984aac0507099af8df275e665215f5c7a2ae3943893a553 vs fd3a137c7e722128143cc8932bcaa00bc73e10adadee18bdb0893453edb2c137

The computed hash (fd3a137c...) matches the checksum published for
golangci-lint-2.12.2-linux-amd64.tar.gz.sbom.json, not the .tar.gz
itself — install.sh's asset-matching picked the wrong file for this
release. Reproduces the same way on darwin-arm64, so it's a bug in
this specific release's assets/naming, not a platform issue.

v2.11.0 installs correctly via the same script (verified locally),
is built with go1.26.1 (satisfies the go1.25 language-version floor
golangci-lint enforces against go.mod), and lints this repo with the
migrated v2 config at 0 issues.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mridulgain mridulgain self-assigned this Aug 19, 2026
@mridulgain
mridulgain requested a review from a team August 19, 2026 06:37
@mridulgain
mridulgain merged commit 5fdab80 into mg/fix-trivy-ci-install-failure Aug 19, 2026
9 of 10 checks passed
@mridulgain
mridulgain deleted the mg/fix-golangci-lint-v2-migration branch August 19, 2026 06:40
mridulgain added a commit that referenced this pull request Aug 19, 2026
…nt cleanup

PR #74's golangci-lint v2 migration blanket-replaced .ObjectMeta.Name
with .Name across storage/kubernetes/storage.go and types.go to
resolve staticcheck's QF1008 "embedded field" suggestions. That's
safe for most types here, but storage/kubernetes.Client declares its
own explicit `Name string` field (the client's display name, e.g.
"dex client"), which shadows the embedded k8sapi.ObjectMeta.Name (the
actual Kubernetes resource name, a hash of the client ID). Go silently
resolves c.Name to the shallower, explicit field, so
DeleteClient/UpdateClient started PUTting/DELETEing using the display
name instead of the resource name -- which fails Kubernetes' DNS1123
name validation (or worse, could target the wrong resource if the
display name happened to be a valid k8s name).

This is exactly why staticcheck itself never flagged these two call
sites (client.go:426,496) even though the blanket sed touched them --
the quickfix check is shadow-aware and only flags genuinely
equivalent simplifications. This regression was introduced by
mechanically applying more replacements than the linter actually
flagged.

Reverts these two call sites to c.ObjectMeta.Name. Verified this was
the only affected type: Connector also declares its own Name field,
but its delete/put call sites already used the id parameter directly
and were untouched by the sed.

Fixes the storage/kubernetes TestStorage/ClientCRUD and
ClientConcurrentUpdate CI failures surfaced on this branch after
merging master (which includes #74).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mridulgain added a commit that referenced this pull request Aug 19, 2026
Fixes the storage/kubernetes TestStorage/ClientCRUD and
ClientConcurrentUpdate CI failures surfaced on this branch after
merging master (which includes #74).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.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