Update golangci-lint to v2.12.2 with canonical config #54
Reference in New Issue
Block a user
Delete Branch "golangci-v2.12.2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replaces
.golangci.ymlwith the canonical v2-schema config (default: allminus six disabled linters,lll88, 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.2with new linux-amd64/arm64 release-archive sha256 pinsFixes all 747 findings the stricter config surfaces, with no behavior changes. Highlights:
t.Parallel()across the test suite (paralleltest), static sentinel errors anderrors.Iscomparisons (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:tagliatelledirectives preserve the existing snake_case JSON formats of the health endpoint and the on-disk cache metadata.make checkis green (tests, lint, fmt-check).@clawbot please fix conflicts
Resolved the merge conflicts with
main(PR #53, startup config validation) and brought the branch back to green. Two new commits:1a15b88merge ofmainintogolangci-v2.12.2ce06170post-merge lint conformance for the code that arrived frommainConflict 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: tookmain's implementation wholesale — none of #53's validation behavior was altered — and re-applied this branch's mechanics on top, including the keylessgetStringSlice(sc)signature thatconfig_internal_test.goexpects.TODO.md: both sides added a Completed Steps entry; kept both, this branch's entry first.config.example.ymland the newconfig_validation_test.goauto-merged cleanly;config.example.ymlends up identical tomain's (#53's correctedsigning_keycomment 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:fmt.Errorfcalls 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 readsconfig key "signing_key": value too short: must be at least 32 characters, got N(still names the key)keyPort,keySigningKey, ...) used consistently inconfig.goand both test filest.Parallel()added to every new test and subtest exceptTestMalformedConfigFileAbortsStartup, which usest.Setenv/t.Chdirand must stay serialif err := ...; err != nilconverted to plain assignmentsinvalidScalarValueCases,invalidHostAndCredentialCases,explicitNullValueCases) plus a sharedrunAbortCaseshelper, following the existingexactMatchTamperCasesprecedent ininternal/signatureconfig_validation_test.gorenamed toconfig_validation_internal_test.goper this branch's conventioninterface{}toany, onestrings.SplitSeqrangeslog.DiscardHandler), embeddedstructfieldcheck (1), nolintlint (2 stale//nolint:gosecdirectives removed)No test assertion, expectation, or coverage was changed — only mechanics (renames, parallelism, table extraction, constant substitution with identical values).
Verification
make checkgreen atce06170(all tests including the 6 new validation test functions, lint 0 issues, fmt-check clean)docker build --target lint .with the pinnedgolangci/golangci-lint:v2.12.2-alpine: 0 issuesport: bananaexits 1 withconfig key "port": value "banana" is not an integer;port: nullexits 1 withconfig key "port": value is null; omit the key entirely to use the default; a valid config boots and serves HTTP 200Note for local checkouts: the shared clone's
golangci-v2.12.2checkout is now behind origin; agit pull --ff-onlythere will sync it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.