Update golangci-lint to v2.12.2 with canonical config #54

Open
clawbot wants to merge 3 commits from golangci-v2.12.2 into main
Collaborator

Replaces .golangci.yml with the canonical v2-schema config (default: all minus six disabled linters, lll 88, tests included) and bumps every golangci-lint pin to v2.12.2:

  • Dockerfile: golangci/golangci-lint:v2.12.2-alpine (hash-pinned, was v2.10.1-alpine)
  • script/bootstrap: GOLANGCI_LINT_VERSION=2.12.2 with new linux-amd64/arm64 release-archive sha256 pins

Fixes all 747 findings the stricter config surfaces, with no behavior changes. Highlights: t.Parallel() across the test suite (paralleltest), static sentinel errors and errors.Is comparisons (err113), checked error returns (errcheck/errchkjson), context propagation (contextcheck/noctx), 88-column wrapping (lll), extracted constants and helpers (goconst/dupl/funlen/cyclop/gocognit), exhaustive switch cases replicating existing defaults, function reordering (funcorder), and white-box test files renamed to *_internal_test.go (testpackage). Three //nolint:tagliatelle directives preserve the existing snake_case JSON formats of the health endpoint and the on-disk cache metadata.

make check is green (tests, lint, fmt-check).

Replaces `.golangci.yml` with the canonical v2-schema config (`default: all` minus six disabled linters, `lll` 88, tests included) and bumps every golangci-lint pin to v2.12.2: - `Dockerfile`: `golangci/golangci-lint:v2.12.2-alpine` (hash-pinned, was v2.10.1-alpine) - `script/bootstrap`: `GOLANGCI_LINT_VERSION=2.12.2` with new linux-amd64/arm64 release-archive sha256 pins Fixes all 747 findings the stricter config surfaces, with no behavior changes. Highlights: `t.Parallel()` across the test suite (paralleltest), static sentinel errors and `errors.Is` comparisons (err113), checked error returns (errcheck/errchkjson), context propagation (contextcheck/noctx), 88-column wrapping (lll), extracted constants and helpers (goconst/dupl/funlen/cyclop/gocognit), exhaustive switch cases replicating existing defaults, function reordering (funcorder), and white-box test files renamed to `*_internal_test.go` (testpackage). Three `//nolint:tagliatelle` directives preserve the existing snake_case JSON formats of the health endpoint and the on-disk cache metadata. `make check` is green (tests, lint, fmt-check).
clawbot added 1 commit 2026-08-07 19:10:37 +02:00
chore: update golangci-lint to v2.12.2 with canonical config
All checks were successful
check / check (push) Successful in 2m3s
23506df609
Replace .golangci.yml with the canonical v2-schema config
(default: all minus six disabled linters, lll 88, tests included)
and bump every golangci-lint pin to v2.12.2:

- Dockerfile: golangci/golangci-lint:v2.12.2-alpine (hash-pinned)
- script/bootstrap: GOLANGCI_LINT_VERSION 2.12.2 with new
  linux-amd64/arm64 release-archive sha256 pins

Fix all 747 findings the stricter config surfaces, with no behavior
changes: t.Parallel() throughout the test suite, static sentinel
errors and errors.Is comparisons, checked error returns, context
propagation (contextcheck/noctx), 88-column wrapping, extracted
constants and helpers for goconst/dupl/funlen/cyclop, exhaustive
switch cases replicating existing defaults, and white-box test files
renamed to *_internal_test.go for testpackage. Three
nolint:tagliatelle directives preserve the existing snake_case JSON
wire and on-disk metadata formats.
Owner

@clawbot please fix conflicts

@clawbot please fix conflicts
clawbot added 2 commits 2026-08-07 23:02:15 +02:00
Resolves conflicts with the startup config validation from #53:
internal/config/config.go takes main's validation implementation
wholesale, with getStringSlice mechanically adapted to this branch's
keyless signature; TODO.md keeps both Completed Steps entries.
chore: conform post-merge config validation code to v2.12.2 lint config
All checks were successful
check / check (push) Successful in 1m44s
ce06170604
The stricter canonical .golangci.yml surfaced 81 findings in the
config validation code merged from main (#53). Fix them all with no
behavior change: static sentinel errors wrapped with %w preserving the
existing messages (err113), config key name constants (goconst),
t.Parallel() throughout except the Setenv/Chdir test (paralleltest),
white-box test renamed to config_validation_internal_test.go
(testpackage), case tables extracted into builder functions plus a
shared runAbortCases helper (funlen/dupl/gochecknoglobals), plain
error assignments (noinlineerr), any instead of interface{} and
strings.SplitSeq (modernize), slog.DiscardHandler (sloglint), 88-col
wrapping (lll), and removal of two stale nolint:gosec directives
(nolintlint).
Author
Collaborator

Resolved the merge conflicts with main (PR #53, startup config validation) and brought the branch back to green. Two new commits:

  • 1a15b88 merge of main into golangci-v2.12.2
  • ce06170 post-merge lint conformance for the code that arrived from main

Conflict resolution

Only two files had textual conflicts:

  • internal/config/config.go: this branch's changes to the file were purely mechanical lint conformance of the pre-#53 code, while #53 rewrote the file entirely (strict getters, null handling, unknown-key detection, range checks, ensureStateDirWritable). Resolution: took main's implementation wholesale — none of #53's validation behavior was altered — and re-applied this branch's mechanics on top, including the keyless getStringSlice(sc) signature that config_internal_test.go expects.
  • TODO.md: both sides added a Completed Steps entry; kept both, this branch's entry first.

config.example.yml and the new config_validation_test.go auto-merged cleanly; config.example.yml ends up identical to main's (#53's corrected signing_key comment preserved). No other file was involved.

Post-merge lint findings in #53's code

The stricter canonical config surfaced 81 findings in internal/config, all fixed in code with no behavior change and no linter-config edits:

  • err113 (24): dynamic fmt.Errorf calls converted to static sentinel errors (errValueNull, errNotAnInteger, errUnknownConfigKeys, ...) wrapped with %w; every existing error message text preserved verbatim except the signing-key length message, which now reads config key "signing_key": value too short: must be at least 32 characters, got N (still names the key)
  • goconst (17): config key names extracted to constants (keyPort, keySigningKey, ...) used consistently in config.go and both test files
  • paralleltest (13): t.Parallel() added to every new test and subtest except TestMalformedConfigFileAbortsStartup, which uses t.Setenv/t.Chdir and must stay serial
  • noinlineerr (13): inline if err := ...; err != nil converted to plain assignments
  • funlen (2) + dupl (2) + gochecknoglobals (2): the two large abort-case tables extracted into case-builder functions (invalidScalarValueCases, invalidHostAndCredentialCases, explicitNullValueCases) plus a shared runAbortCases helper, following the existing exactMatchTamperCases precedent in internal/signature
  • testpackage (1): white-box config_validation_test.go renamed to config_validation_internal_test.go per this branch's convention
  • modernize (4): interface{} to any, one strings.SplitSeq range
  • lll (4), sloglint (1, slog.DiscardHandler), embeddedstructfieldcheck (1), nolintlint (2 stale //nolint:gosec directives removed)

No test assertion, expectation, or coverage was changed — only mechanics (renames, parallelism, table extraction, constant substitution with identical values).

Verification

  • make check green at ce06170 (all tests including the 6 new validation test functions, lint 0 issues, fmt-check clean)
  • Authoritative docker build --target lint . with the pinned golangci/golangci-lint:v2.12.2-alpine: 0 issues
  • End-to-end startup validation still works: port: banana exits 1 with config key "port": value "banana" is not an integer; port: null exits 1 with config key "port": value is null; omit the key entirely to use the default; a valid config boots and serves HTTP 200

Note for local checkouts: the shared clone's golangci-v2.12.2 checkout is now behind origin; a git pull --ff-only there will sync it.

Resolved the merge conflicts with `main` (PR #53, startup config validation) and brought the branch back to green. Two new commits: - `1a15b88` merge of `main` into `golangci-v2.12.2` - `ce06170` post-merge lint conformance for the code that arrived from `main` ## Conflict resolution Only two files had textual conflicts: - `internal/config/config.go`: this branch's changes to the file were purely mechanical lint conformance of the pre-#53 code, while #53 rewrote the file entirely (strict getters, null handling, unknown-key detection, range checks, `ensureStateDirWritable`). Resolution: took `main`'s implementation wholesale — none of #53's validation behavior was altered — and re-applied this branch's mechanics on top, including the keyless `getStringSlice(sc)` signature that `config_internal_test.go` expects. - `TODO.md`: both sides added a Completed Steps entry; kept both, this branch's entry first. `config.example.yml` and the new `config_validation_test.go` auto-merged cleanly; `config.example.yml` ends up identical to `main`'s (#53's corrected `signing_key` comment preserved). No other file was involved. ## Post-merge lint findings in #53's code The stricter canonical config surfaced 81 findings in `internal/config`, all fixed in code with no behavior change and no linter-config edits: - err113 (24): dynamic `fmt.Errorf` calls converted to static sentinel errors (`errValueNull`, `errNotAnInteger`, `errUnknownConfigKeys`, ...) wrapped with `%w`; every existing error message text preserved verbatim except the signing-key length message, which now reads `config key "signing_key": value too short: must be at least 32 characters, got N` (still names the key) - goconst (17): config key names extracted to constants (`keyPort`, `keySigningKey`, ...) used consistently in `config.go` and both test files - paralleltest (13): `t.Parallel()` added to every new test and subtest except `TestMalformedConfigFileAbortsStartup`, which uses `t.Setenv`/`t.Chdir` and must stay serial - noinlineerr (13): inline `if err := ...; err != nil` converted to plain assignments - funlen (2) + dupl (2) + gochecknoglobals (2): the two large abort-case tables extracted into case-builder functions (`invalidScalarValueCases`, `invalidHostAndCredentialCases`, `explicitNullValueCases`) plus a shared `runAbortCases` helper, following the existing `exactMatchTamperCases` precedent in `internal/signature` - testpackage (1): white-box `config_validation_test.go` renamed to `config_validation_internal_test.go` per this branch's convention - modernize (4): `interface{}` to `any`, one `strings.SplitSeq` range - lll (4), sloglint (1, `slog.DiscardHandler`), embeddedstructfieldcheck (1), nolintlint (2 stale `//nolint:gosec` directives removed) No test assertion, expectation, or coverage was changed — only mechanics (renames, parallelism, table extraction, constant substitution with identical values). ## Verification - `make check` green at `ce06170` (all tests including the 6 new validation test functions, lint 0 issues, fmt-check clean) - Authoritative `docker build --target lint .` with the pinned `golangci/golangci-lint:v2.12.2-alpine`: 0 issues - End-to-end startup validation still works: `port: banana` exits 1 with `config key "port": value "banana" is not an integer`; `port: null` exits 1 with `config key "port": value is null; omit the key entirely to use the default`; a valid config boots and serves HTTP 200 Note for local checkouts: the shared clone's `golangci-v2.12.2` checkout is now behind origin; a `git pull --ff-only` there will sync it.
Some checks are pending
check / check (push) Successful in 1m44s
Check / check (pull_request)
Required
Some required checks are missing.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin golangci-v2.12.2:golangci-v2.12.2
git checkout golangci-v2.12.2
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#54