fix(lint): resolve all errcheck warnings
Fix ~50 errcheck warnings across the codebase:
- Add explicit `_ =` for intentionally ignored error returns (cleanup,
best-effort operations, etc.)
- Use `defer func() { _ = ... }()` pattern for defer statements
- Handle tmux SetEnvironment, KillSession, SendKeysRaw returns
- Handle mail router.Send returns
- Handle os.RemoveAll, os.Rename in cleanup paths
- Handle rand.Read returns for ID generation
- Handle fmt.Fprint* returns when writing to io.Writer
- Fix for-select with single case to use for-range
- Handle cobra MarkFlagRequired returns
All tests pass. Code compiles without errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,9 +37,7 @@ func (m *Manager) CreateIntegrationBranch(swarmID string) error {
|
||||
}
|
||||
|
||||
// Push to origin
|
||||
if err := m.gitRun("push", "-u", "origin", branchName); err != nil {
|
||||
// Non-fatal - may not have remote
|
||||
}
|
||||
_ = m.gitRun("push", "-u", "origin", branchName) // Non-fatal - may not have remote
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -64,9 +62,7 @@ func (m *Manager) MergeToIntegration(swarmID, workerBranch string) error {
|
||||
}
|
||||
|
||||
// Fetch the worker branch
|
||||
if err := m.gitRun("fetch", "origin", workerBranch); err != nil {
|
||||
// May not exist on remote, try local
|
||||
}
|
||||
_ = m.gitRun("fetch", "origin", workerBranch) // May not exist on remote, try local
|
||||
|
||||
// Attempt merge
|
||||
err = m.gitRun("merge", "--no-ff", "-m",
|
||||
@@ -102,7 +98,7 @@ func (m *Manager) LandToMain(swarmID string) error {
|
||||
}
|
||||
|
||||
// Pull latest
|
||||
m.gitRun("pull", "origin", swarm.TargetBranch) // Ignore errors
|
||||
_ = m.gitRun("pull", "origin", swarm.TargetBranch) // Ignore errors
|
||||
|
||||
// Merge integration branch
|
||||
err := m.gitRun("merge", "--no-ff", "-m",
|
||||
@@ -138,15 +134,15 @@ func (m *Manager) CleanupBranches(swarmID string) error {
|
||||
}
|
||||
|
||||
// Delete integration branch remotely
|
||||
m.gitRun("push", "origin", "--delete", swarm.Integration) // Ignore errors
|
||||
_ = m.gitRun("push", "origin", "--delete", swarm.Integration) // Ignore errors
|
||||
|
||||
// Delete worker branches
|
||||
for _, task := range swarm.Tasks {
|
||||
if task.Branch != "" {
|
||||
// Local delete
|
||||
m.gitRun("branch", "-D", task.Branch)
|
||||
_ = m.gitRun("branch", "-D", task.Branch)
|
||||
// Remote delete
|
||||
m.gitRun("push", "origin", "--delete", task.Branch)
|
||||
_ = m.gitRun("push", "origin", "--delete", task.Branch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ Manual intervention required.`,
|
||||
swarmID, strings.Join(workers, "\n- ")),
|
||||
Priority: mail.PriorityHigh,
|
||||
}
|
||||
router.Send(msg)
|
||||
_ = router.Send(msg)
|
||||
}
|
||||
|
||||
// notifyMayorLanded sends a landing report to Mayor.
|
||||
@@ -233,5 +233,5 @@ Tasks merged: %d`,
|
||||
result.BranchesCleaned,
|
||||
len(swarm.Tasks)),
|
||||
}
|
||||
router.Send(msg)
|
||||
_ = router.Send(msg)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func TestManagerCancel(t *testing.T) {
|
||||
m := NewManager(r)
|
||||
|
||||
swarm, _ := m.Create("epic-1", []string{"Toast"}, "main")
|
||||
m.Start(swarm.ID)
|
||||
_ = m.Start(swarm.ID)
|
||||
|
||||
if err := m.Cancel(swarm.ID, "user requested"); err != nil {
|
||||
t.Errorf("Cancel failed: %v", err)
|
||||
@@ -179,7 +179,7 @@ func TestManagerIsComplete(t *testing.T) {
|
||||
}
|
||||
|
||||
// Complete the pending task
|
||||
m.UpdateTaskState(swarm.ID, "task-1", TaskMerged)
|
||||
_ = m.UpdateTaskState(swarm.ID, "task-1", TaskMerged)
|
||||
complete, _ = m.IsComplete(swarm.ID)
|
||||
if !complete {
|
||||
t.Error("IsComplete should be true when all tasks merged")
|
||||
|
||||
Reference in New Issue
Block a user