fix(lint): resolve golangci-lint v2 violations (51->0)#12
Merged
Conversation
… (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.
# Conflicts: # .github/workflows/push.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the codebase clean under golangci-lint v2.12.2 —
golangci-lint run ./...now reports 0 issues (was 51 onmaster: 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) enablingerrcheck,govet,staticcheck,unused— no linter blanket-disabled.Changes per category
errcheck — unchecked error returns handled explicitly:
Close()/Shutdown()→defer func() { _ = X.Close() }()(cmd/engram, otel exporters + tests, embedding openai/voyage, dream/gate, server eval/http/legacy/collections tests, sync).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: passcontext.TODO()instead ofnilContext (reflection engine_batch2_test).S1024:parsed.Sub(time.Now())→time.Until(parsed).unused:
dailyCountEntrystruct (reflection/trigger —readDailyCountusesfmt.Sscanf, not the struct).handleReflectionRunEvent: retained with a targeted//nolint:unused+ justification. It's a fully-implemented MCP handler staged in commit8dd5200(W17 v1.1 batch 2) ahead of tool registration; not dead (RunSingleEventis 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.mdWIP and untrackedexamples/dirs were intentionally NOT included.Marked for BMO review — Coding v2: 24h no-response = non-blocking merge.
References BMO thread
19f330bb90ddebe6.