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:
sam committed 2026-07-27 03:49:33 +10:00
1 parent 64352a06f3
commit 6fe1a7d037
19 files changed
+219 -183

No files matched your search

+6 -6
View File
@@ -342,7 +342,7 @@ func (m *Manager) OnTurnStart(sessionID string) {
for _, p := range providers {
if h, ok := p.(TurnStartHook); ok {
safeGo(func() { h.OnTurnStart(sessionID) })
safeGo(func() { _ = h.OnTurnStart(sessionID) })
}
}
}
@@ -354,7 +354,7 @@ func (m *Manager) OnSessionEnd(sessionID string) {
for _, p := range providers {
if h, ok := p.(SessionEndHook); ok {
safeGo(func() { h.OnSessionEnd(sessionID) })
safeGo(func() { _ = h.OnSessionEnd(sessionID) })
}
}
}
@@ -366,7 +366,7 @@ func (m *Manager) OnSessionSwitch(oldSessionID, newSessionID string) {
for _, p := range providers {
if h, ok := p.(SessionSwitchHook); ok {
safeGo(func() { h.OnSessionSwitch(oldSessionID, newSessionID) })
safeGo(func() { _ = h.OnSessionSwitch(oldSessionID, newSessionID) })
}
}
}
@@ -378,7 +378,7 @@ func (m *Manager) OnPreCompress(sessionID string) {
for _, p := range providers {
if h, ok := p.(PreCompressHook); ok {
safeGo(func() { h.OnPreCompress(sessionID) })
safeGo(func() { _ = h.OnPreCompress(sessionID) })
}
}
}
@@ -390,7 +390,7 @@ func (m *Manager) OnMemoryWrite(sessionID string, content string) {
for _, p := range providers {
if h, ok := p.(MemoryWriteHook); ok {
safeGo(func() { h.OnMemoryWrite(sessionID, content) })
safeGo(func() { _ = h.OnMemoryWrite(sessionID, content) })
}
}
}
@@ -402,7 +402,7 @@ func (m *Manager) OnDelegation(sessionID string) {
for _, p := range providers {
if h, ok := p.(DelegationHook); ok {
safeGo(func() { h.OnDelegation(sessionID) })
safeGo(func() { _ = h.OnDelegation(sessionID) })
}
}
}