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

Merged
sneak merged 1 commits from golangci-v2.12.2 into main 2026-08-10 15:40:05 +02:00
Collaborator

Adds the canonical .golangci.yml (v2 schema, default: all with a small documented disable list) and pins the Dockerfile lint stage to golangci/golangci-lint:v2.12.2 by tag and digest, replacing the previous v1.64.8 digest-only pin. The Makefile invokes golangci-lint unversioned and CI builds via Docker, so no other pins existed.

The v1 to v2 jump surfaced 74 findings; all are fixed with no changes to exported signatures or runtime behavior:

  • doc comments for the package and all exported symbols; unused handler parameters renamed to _ (revive, 38)
  • blank-line and whitespace conventions (nlreturn 8, wsl_v5 4, whitespace 1, embeddedstructfieldcheck 1)
  • errors wrapped with %w instead of %v (err113, 2)
  • error returns checked or explicitly discarded (errcheck 2, errchkjson 1)
  • http.NewRequestWithContext + http.DefaultClient.Do instead of http.Post, propagating the handler context (noctx)
  • fmt.Fprintln(os.Stdout, ...) instead of fmt.Println (forbidigo)
  • magic numbers named as constants (mnd, 2)
  • explicit slog.LevelDebug case, same white color as before (exhaustive)
  • interface{} to any (modernize)
  • tests moved to package simplelog_test with t.Parallel() (testpackage 2, paralleltest 1)
  • constructor ordering and long-line wrapping (funcorder, lll)

Three //nolint directives with justifications cover the package's intentional design: gochecknoinits/gochecknoglobals for the install-on-import default logger, and ireturn for NewExtendedEvent returning the exported ExtendedEvent interface.

make check (fmt-check, lint, test) is green. TODO.md Completed Steps updated in the same commit.

Noted while in here, not touched: golangci-lint warns that gomodguard is deprecated since v2.12.0 in favor of gomodguard_v2 (config is canonical and shared, so left as is), and the Dockerfile test stage still pins golang 1.22.12 from 2025-02.

Adds the canonical `.golangci.yml` (v2 schema, `default: all` with a small documented disable list) and pins the `Dockerfile` lint stage to `golangci/golangci-lint:v2.12.2` by tag and digest, replacing the previous v1.64.8 digest-only pin. The `Makefile` invokes `golangci-lint` unversioned and CI builds via Docker, so no other pins existed. The v1 to v2 jump surfaced 74 findings; all are fixed with no changes to exported signatures or runtime behavior: - doc comments for the package and all exported symbols; unused handler parameters renamed to `_` (revive, 38) - blank-line and whitespace conventions (`nlreturn` 8, `wsl_v5` 4, `whitespace` 1, `embeddedstructfieldcheck` 1) - errors wrapped with `%w` instead of `%v` (`err113`, 2) - error returns checked or explicitly discarded (`errcheck` 2, `errchkjson` 1) - `http.NewRequestWithContext` + `http.DefaultClient.Do` instead of `http.Post`, propagating the handler context (`noctx`) - `fmt.Fprintln(os.Stdout, ...)` instead of `fmt.Println` (`forbidigo`) - magic numbers named as constants (`mnd`, 2) - explicit `slog.LevelDebug` case, same white color as before (`exhaustive`) - `interface{}` to `any` (`modernize`) - tests moved to `package simplelog_test` with `t.Parallel()` (`testpackage` 2, `paralleltest` 1) - constructor ordering and long-line wrapping (`funcorder`, `lll`) Three `//nolint` directives with justifications cover the package's intentional design: `gochecknoinits`/`gochecknoglobals` for the install-on-import default logger, and `ireturn` for `NewExtendedEvent` returning the exported `ExtendedEvent` interface. `make check` (fmt-check, lint, test) is green. `TODO.md` Completed Steps updated in the same commit. Noted while in here, not touched: golangci-lint warns that `gomodguard` is deprecated since v2.12.0 in favor of `gomodguard_v2` (config is canonical and shared, so left as is), and the `Dockerfile` test stage still pins `golang` 1.22.12 from 2025-02.
clawbot added 1 commit 2026-08-07 19:10:17 +02:00
build: update golangci-lint to v2.12.2 with canonical config
All checks were successful
check / check (push) Successful in 29s
check / check (pull_request) Successful in 32s
403ba4c42e
Add the canonical .golangci.yml (v2 schema, all linters enabled with a
small documented disable list) and pin the Dockerfile lint stage to
golangci/golangci-lint:v2.12.2 by tag and digest, replacing the old
v1.64.8 digest-only pin.

Fix all findings surfaced by the v1 to v2 jump without changing any
exported signatures or behavior:

- add package and exported-symbol doc comments (revive)
- rename unused handler parameters to underscore (revive)
- check or explicitly discard error returns (errcheck, errchkjson)
- wrap errors with %w instead of %v (err113)
- use http.NewRequestWithContext instead of http.Post (noctx)
- replace fmt.Println with fmt.Fprintln(os.Stdout, ...) (forbidigo)
- name magic numbers as constants (mnd)
- add explicit slog.LevelDebug case (exhaustive)
- interface{} to any (modernize)
- move tests to the simplelog_test package (testpackage) and add
  t.Parallel() (paralleltest)
- move NewWebhookHandler above its methods (funcorder)
- whitespace, line-length, and blank-line fixes (wsl_v5, whitespace,
  nlreturn, lll, embeddedstructfieldcheck)
- nolint with justification for the intentional init/global design
  (gochecknoinits, gochecknoglobals) and interface-returning
  constructor (ireturn)
sneak merged commit 64c30e979d into main 2026-08-10 15:40:05 +02:00
sneak deleted branch golangci-v2.12.2 2026-08-10 15:40:05 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/simplelog#17