lint: resolve all gocritic findings #583

Open
opened 2026-09-22 17:10:40 +00:00 by hexajon · 0 comments
Owner

Context

gocritic reports 13 findings under the default check set. Two of them may be
real bugs, not style.

What

Fix every gocritic finding. Handle these classes:

  • appendAssign at internal/cmd/git/diff.go:72,79: the append result is
    assigned to a different slice than the one it was called on. Confirm whether
    this is a real argument-construction bug before rewriting.
  • mapKey at internal/service/issue_close_reason_test.go:185: a suspicious
    " closed " key with surrounding whitespace. Confirm whether the whitespace
    is the point of the test or a bug.
  • unlambda: single-use wrapper closures in internal/service/git/status.go,
    internal/mcp/tools_admin_hooks.go, internal/mcp/tools_repos_meta.go,
    internal/service/workflow/helpers.go, internal/cmd/repo/repo_content.go.
    Replace with direct function references. The status.go case is a test
    injection seam; check for tests that rely on the closure before collapsing
    it.
  • ifElseChain x2, elseif x2, deprecatedComment x1: mechanical rewrites.

Files touched: internal/cmd/git/diff.go, internal/cmd/repo/repo_content.go,
internal/config/git.go, internal/format/format.go,
internal/format/prune/result.go, internal/gitea/client_flavour_test.go,
internal/mcp/tools_admin_hooks.go, internal/mcp/tools_issues_test.go,
internal/mcp/tools_repos_meta.go, internal/service/git/status.go,
internal/service/issue_close_reason_test.go,
internal/service/workflow/helpers.go.

Acceptance

  • golangci-lint reports zero gocritic findings.
  • go test ./... stays green.
  • The issue records whether appendAssign and mapKey were bugs or false alarms,
    not just silenced.
## Context gocritic reports 13 findings under the default check set. Two of them may be real bugs, not style. ## What Fix every gocritic finding. Handle these classes: - `appendAssign` at `internal/cmd/git/diff.go:72,79`: the append result is assigned to a different slice than the one it was called on. Confirm whether this is a real argument-construction bug before rewriting. - `mapKey` at `internal/service/issue_close_reason_test.go:185`: a suspicious `" closed "` key with surrounding whitespace. Confirm whether the whitespace is the point of the test or a bug. - `unlambda`: single-use wrapper closures in `internal/service/git/status.go`, `internal/mcp/tools_admin_hooks.go`, `internal/mcp/tools_repos_meta.go`, `internal/service/workflow/helpers.go`, `internal/cmd/repo/repo_content.go`. Replace with direct function references. The status.go case is a test injection seam; check for tests that rely on the closure before collapsing it. - `ifElseChain` x2, `elseif` x2, `deprecatedComment` x1: mechanical rewrites. Files touched: `internal/cmd/git/diff.go`, `internal/cmd/repo/repo_content.go`, `internal/config/git.go`, `internal/format/format.go`, `internal/format/prune/result.go`, `internal/gitea/client_flavour_test.go`, `internal/mcp/tools_admin_hooks.go`, `internal/mcp/tools_issues_test.go`, `internal/mcp/tools_repos_meta.go`, `internal/service/git/status.go`, `internal/service/issue_close_reason_test.go`, `internal/service/workflow/helpers.go`. ## Acceptance - golangci-lint reports zero gocritic findings. - `go test ./...` stays green. - The issue records whether appendAssign and mapKey were bugs or false alarms, not just silenced.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#583
No description provided.