Skip to content

golangci-lint v2.12.x bumps goconst lib to v1.10.0 -- floods consumer repos with new violations on next Align files run #1802

Description

@teemow

Problem

giantswarm/devctl PR #1793 (merged 2026-05-06) bumped the embedded golangci-lint version from 2.11.4 to 2.12.2. The new version embeds github.com/jgautheron/goconst v1.10.0 (was v1.8.2 in 2.11.4) and adds a new ignore-tests setting (golangci/golangci-lint#6480 in v2.12.0).

Two things change in practice:

  1. The default goconst behavior is more aggressive. v1.9.0 and v1.10.0 both adjust how literals are counted, so strings that previously didn't qualify as repeated constants now do.
  2. There is no default to ignore test files, so test fixtures that repeat a string 3+ times (very common: "text", "foo", "S256", "Bearer", "https://issuer.example.com") now get flagged.

The languages/go/.pre-commit-config.yaml template enables goconst with -E=goconst and does not pin it down with min-occurrences, min-len, or ignore-tests. So as soon as Align files lands the new zz_generated.pre-commit.yaml in a consumer repo, the pre-commit job goes red across the entire repo's PR queue.

Observed in the 2026-05-07 marge sweep:

Repo New goconst violations after bump Outcome
giantswarm/lab 11 (production + test) Fixable; fixed in giantswarm/lab#77 by extracting constants
giantswarm/muster 947 (mostly test fixtures) Too large to fix in one rescue agent run; muster Align files PR (#629) blocked

The pattern matches the "Shared CI infrastructure failures (not the dependency)" recipe in klaus-lab/workflows/marge-sweep.md -- a single upstream change cascades to many downstream PR failures.

Proposed solution

Pick one of:

  1. Tune goconst defaults in the shared .pre-commit-config.yaml template to match the v1.8.2 behavior more closely. Either:

    • Bump min-occurrences higher (e.g. 5 instead of the default 3), and/or
    • Set ignore-tests: true so test-fixture noise no longer trips the linter.
    • Set min-len higher (e.g. 5) so single-letter / short strings (auth, dev, text, name) are excluded.
  2. Pin golangci-lint back to 2.11.4 in pkg/gen/input/precommit/ until the goconst v1.10.0 behavior is reviewed and applied intentionally.

  3. Drop goconst from the default -E= args -- it is a stylistic linter that produces high-noise output for code with many small repeated literals (especially in tests). Repos that want it can opt back in via their own .golangci.yml.

Option 1 is the lowest-blast-radius fix. The settings travel through pre_commit_go.yaml / .pre-commit-config.yaml and are picked up automatically when downstream repos receive the next Align files run.

Acceptance criteria

  • A consumer repo with healthy code (e.g. a clean klaus-lab/lab after fix-PR add shorthand flag for easier use #77 merges) passes the new pre-commit job with golangci-lint 2.12.2 enabled, without per-repo .golangci.yml overrides, and without flagging test-fixture string repetitions.
  • Existing consumer repos with backlog goconst debt (e.g. muster) do not need a 947-violation fix-PR to unblock their PR queue. Either they stay green by default, or they use a per-repo .golangci.yml that silences the test-fixture noise (which still requires this PR to add the override knob into the template's documented config surface).
  • A note in CHANGELOG.md mentioning the goconst tuning change so consumers can correlate it with their next Align files run.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions