fix: lint cleanup across repo (errcheck, staticcheck, ineffassign, unused)
- daemon.go: real bug — maybeRetryParked resolved fg := d.forgeFor(task) (matching markDead's pattern) but called d.Forge.SetStateLabel instead of fg.SetStateLabel, silently using the wrong forge client for multi-identity/multi-forge task routing. Fixed to use fg throughout. - telegram.go: updateThreadID existed but was never called anywhere; wired it into updateLoggingMiddleware so debug logs include thread_id. - Two SA9003 empty-branch tests (nell adapter_test.go, tools toolentry_test.go) were dead assertions with no body; implemented the actual check instead of deleting them. - memory manager_test.go: mockProvider.lastConfigSchema/lastBackupPaths were declared but never recorded; wired GetConfigSchema/BackupPaths to populate them and strengthened the aggregation tests to assert on per-provider content, not just counts. - Removed genuinely dead gateway messageevent_test.go helpers (intPtr/ i64Ptr, marked //go:fix inline, already fully superseded by the new() builtin used throughout the file). - Remaining errcheck findings (defer Close/Flush/Write, os.Setenv, etc. in test files) fixed with the existing `_ = ` convention already used elsewhere in the codebase. go build ./..., go test ./... (all packages ok), and golangci-lint run ./... all clean.
This commit is contained in:
1 parent
64352a06f3
commit
6fe1a7d037
19 files changed
+219
-183
No files matched your search
@@ -179,12 +179,12 @@ func TestWriteTaskJSONOverwrite(t *testing.T) {
|
||||
p1 := TaskPayload{ID: 1, Title: "first"}
|
||||
p2 := TaskPayload{ID: 2, Title: "second"}
|
||||
|
||||
WriteTaskJSON(dir, p1)
|
||||
WriteTaskJSON(dir, p2) // overwrite
|
||||
_ = WriteTaskJSON(dir, p1)
|
||||
_ = WriteTaskJSON(dir, p2) // overwrite
|
||||
|
||||
data, _ := os.ReadFile(filepath.Join(dir, "task.json"))
|
||||
var decoded TaskPayload
|
||||
json.Unmarshal(data, &decoded)
|
||||
_ = json.Unmarshal(data, &decoded)
|
||||
|
||||
if decoded.ID != 2 || decoded.Title != "second" {
|
||||
t.Errorf("expected second payload, got ID=%d Title=%q", decoded.ID, decoded.Title)
|
||||
@@ -201,7 +201,7 @@ func TestWriteTaskJSONMinimalPayload(t *testing.T) {
|
||||
|
||||
data, _ := os.ReadFile(filepath.Join(dir, "task.json"))
|
||||
var decoded TaskPayload
|
||||
json.Unmarshal(data, &decoded)
|
||||
_ = json.Unmarshal(data, &decoded)
|
||||
|
||||
if decoded.ID != 1 {
|
||||
t.Error("minimal payload ID mismatch")
|
||||
|
||||
Reference in new issue
Block a user