Skip to content

fix(lint): resolve golangci-lint v2 violations (51->0)#12

Merged
FBISiri merged 4 commits into
masterfrom
fix/golangci-v2-lint
Jul 14, 2026
Merged

fix(lint): resolve golangci-lint v2 violations (51->0)#12
FBISiri merged 4 commits into
masterfrom
fix/golangci-v2-lint

Conversation

@FBISiri

@FBISiri FBISiri commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Makes the codebase clean under golangci-lint v2.12.2golangci-lint run ./... now reports 0 issues (was 51 on master: errcheck=43, staticcheck=6, unused=2). CI still pins v1.62 during the v2 migration window; that pin is intentionally left unchanged. Adds a .golangci.yml (v2 schema) enabling errcheck, govet, staticcheck, unused — no linter blanket-disabled.

Changes per category

errcheck — unchecked error returns handled explicitly:

  • deferred Close()/Shutdown()defer func() { _ = X.Close() }() (cmd/engram, otel exporters + tests, embedding openai/voyage, dream/gate, server eval/http/legacy/collections tests, sync).
  • fire-and-forget calls (json.Encode/json.Unmarshal, os.Remove, callTool, Flush) → _ = ....

staticcheck:

  • QF1012: sb.WriteString(fmt.Sprintf(...))fmt.Fprintf(&sb, ...) (reflection engine/pipeline/prompt/dialectic, dream/engine).
  • SA1012: pass context.TODO() instead of nil Context (reflection engine_batch2_test).
  • S1024: parsed.Sub(time.Now())time.Until(parsed).

unused:

  • removed dead dailyCountEntry struct (reflection/trigger — readDailyCount uses fmt.Sscanf, not the struct).
  • handleReflectionRunEvent: retained with a targeted //nolint:unused + justification. It's a fully-implemented MCP handler staged in commit 8dd5200 (W17 v1.1 batch 2) ahead of tool registration; not dead (RunSingleEvent is exercised by engine tests). Wiring it up would add new public MCP API (out of scope for a lint fix); deleting would drop intended, staged work. Flagged for reviewer to decide wire-vs-drop.

Verification

  • go build ./...go vet ./...
  • golangci-lint run ./...0 issues
  • go test -short -count=1 ./... → all packages pass ✅

Note: unrelated README.md WIP and untracked examples/ dirs were intentionally NOT included.


Marked for BMO review — Coding v2: 24h no-response = non-blocking merge.

References BMO thread 19f330bb90ddebe6.

FBISiri added 4 commits July 6, 2026 12:25
… (BMO thread:19f330bb90ddebe6)

Make the codebase clean under golangci-lint v2.12.2 (0 issues). CI still
pins v1.62 during the v2 migration window — that pin is intentionally
unchanged.

Changes per linter category:

errcheck (unchecked errors): wrap ignored returns explicitly.
  - deferred Close()/Shutdown() -> `defer func() { _ = X.Close() }()`
    across cmd/engram, otel exporters/tests, embedding openai/voyage,
    dream/gate, server eval/http/legacy/collections tests, sync.
  - fire-and-forget calls (json.Encode/Unmarshal, os.Remove, callTool,
    Flush) -> `_ = ...`.

staticcheck:
  - QF1012: `sb.WriteString(fmt.Sprintf(...))` -> `fmt.Fprintf(&sb, ...)`
    in reflection engine/pipeline/prompt/dialectic and dream/engine.
  - SA1012: pass context.TODO() instead of nil Context in
    reflection engine_batch2_test.
  - S1024: `parsed.Sub(time.Now())` -> `time.Until(parsed)`.

unused:
  - remove dead `dailyCountEntry` struct in reflection/trigger
    (readDailyCount uses fmt.Sscanf, not this struct).
  - handleReflectionRunEvent: kept with a targeted `//nolint:unused`
    (staged in commit 8dd5200 ahead of tool registration; not dead —
    RunSingleEvent is covered by engine tests). Flagged for reviewer.

Add .golangci.yml (v2 schema) enabling errcheck, govet, staticcheck,
unused. No linter blanket-disabled.
The lint job failed with 'the Go language version (go1.23) used to build
golangci-lint is lower than the targeted Go version (1.25.0)': CI pinned
golangci-lint v1.62 (built with go1.23) against a v2-schema .golangci.yml
and go.mod go1.25 — a three-way incompatibility. The 51 code violations
were already fixed; only the toolchain pin remained.

Switch golangci-lint-action@v6 -> @v8 and version v1.62 -> v2.12.2 so the
action matches the v2 config and go1.25. Verified locally: go vet clean,
golangci-lint config verify OK, golangci-lint run ./... = 0 issues.
@FBISiri FBISiri merged commit 00864a2 into master Jul 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant