Adopt golangci-lint v2.12.2 and the canonical .golangci.yml #60

Closed
opened 2026-08-09 03:36:42 +02:00 by clawbot · 0 comments
Collaborator

Context

main currently has no .golangci.yml at all, so golangci-lint runs with
its built-in defaults. Repo policy requires the standardized, user-owned
config fetched verbatim from the prompts repo, and requires every external
reference to be pinned.

This is the first work unit for 1.0 because the lint configuration governs
the gate that every subsequent PR must pass. Nothing else should land ahead
of it.

Definition of done

  • .golangci.yml is present in the repo root and is byte-identical to
    https://git.eeqj.de/sneak/prompts/raw/branch/main/.golangci.yml
    (sha256 021cc83f4e6fc7c31b95b34b846723dfcf20b66b7baeea1dc40406e643346bcb).
  • The golangci-lint version pin is v2.12.2 everywhere it appears
    (Makefile, Dockerfile), with the Dockerfile stage pinned by
    @sha256: digest and carrying a dated version comment.
  • Every finding surfaced by golangci-lint v2.12.2 under that config is
    fixed across cmd/, internal/, and mfer/.
  • docker build . succeeds end-to-end (this is the authoritative gate; it
    runs the pinned linter, unlike a developer's locally installed one).
  • TODO.md is updated in the same commit as the work.

Implementation requirements

  • .golangci.yml is user-owned and must never be modified. Copy it
    verbatim; do not add, remove, or reorder a single line to make findings go
    away. If a rule is genuinely wrong for this repo, that is an owner
    decision — raise it, do not edit the file.
  • Lint findings must be fixed by changing the code, not by blanket
    //nolint. Each //nolint that survives must be narrowly scoped to a
    single linter and carry a //nolint:linter // reason explanation. Keep the
    count low and be prepared to justify every one.
  • Refactors performed to satisfy funlen / cyclop / gocognit / nestif
    must be behavior-preserving. Decomposition into helpers is fine;
    changing control flow, error semantics, or output is not.
  • Do not reformat REPO_POLICIES.md. It is a verbatim copy of the
    authoritative document in the prompts repo and must stay byte-identical
    to it. If the repo's formatter rewrites it, that is a separate bug to file,
    not something to commit here.
  • Test-suite changes made to satisfy paralleltest / usetesting must not
    weaken coverage or introduce cross-test interference. If a test cannot
    safely run in parallel, say so in a comment rather than forcing it.
  • The commit title must end with (closes #60).

Notes

Local golangci-lint installs are currently unpinned (see the separate
bootstrap issue), so a developer machine may report a different finding set
than CI. Trust docker build ., not the local binary.

## Context `main` currently has no `.golangci.yml` at all, so `golangci-lint` runs with its built-in defaults. Repo policy requires the standardized, user-owned config fetched verbatim from the `prompts` repo, and requires every external reference to be pinned. This is the first work unit for 1.0 because the lint configuration governs the gate that every subsequent PR must pass. Nothing else should land ahead of it. ## Definition of done - `.golangci.yml` is present in the repo root and is **byte-identical** to `https://git.eeqj.de/sneak/prompts/raw/branch/main/.golangci.yml` (sha256 `021cc83f4e6fc7c31b95b34b846723dfcf20b66b7baeea1dc40406e643346bcb`). - The `golangci-lint` version pin is `v2.12.2` everywhere it appears (`Makefile`, `Dockerfile`), with the `Dockerfile` stage pinned by `@sha256:` digest and carrying a dated version comment. - Every finding surfaced by `golangci-lint` v2.12.2 under that config is fixed across `cmd/`, `internal/`, and `mfer/`. - `docker build .` succeeds end-to-end (this is the authoritative gate; it runs the pinned linter, unlike a developer's locally installed one). - `TODO.md` is updated in the same commit as the work. ## Implementation requirements - `.golangci.yml` is **user-owned and must never be modified**. Copy it verbatim; do not add, remove, or reorder a single line to make findings go away. If a rule is genuinely wrong for this repo, that is an owner decision — raise it, do not edit the file. - Lint findings must be fixed by **changing the code**, not by blanket `//nolint`. Each `//nolint` that survives must be narrowly scoped to a single linter and carry a `//nolint:linter // reason` explanation. Keep the count low and be prepared to justify every one. - Refactors performed to satisfy `funlen` / `cyclop` / `gocognit` / `nestif` must be **behavior-preserving**. Decomposition into helpers is fine; changing control flow, error semantics, or output is not. - Do not reformat `REPO_POLICIES.md`. It is a verbatim copy of the authoritative document in the `prompts` repo and must stay byte-identical to it. If the repo's formatter rewrites it, that is a separate bug to file, not something to commit here. - Test-suite changes made to satisfy `paralleltest` / `usetesting` must not weaken coverage or introduce cross-test interference. If a test cannot safely run in parallel, say so in a comment rather than forcing it. - The commit title must end with ` (closes #60)`. ## Notes Local `golangci-lint` installs are currently unpinned (see the separate bootstrap issue), so a developer machine may report a different finding set than CI. Trust `docker build .`, not the local binary.
clawbot added this to the 1.0.0 milestone 2026-08-09 03:36:42 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/mfer#60