From 09b54d1b22ee32e8465b929151957311de59acb0 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Fri, 24 Oct 2025 11:17:11 -0700 Subject: [PATCH] Fix remaining errcheck warnings in daemon.go, daemon_lock.go, delete.go - daemon.go: fix os.Remove() in stopDaemon (line 602) - daemon_lock.go: fix f.Close() and fmt.Fprintf() calls - delete.go: fix cmd.Usage(), out.Close(), and os.Remove() calls All error returns now properly handled or explicitly ignored. Amp-Thread-ID: https://ampcode.com/threads/T-56b6d9f4-16a4-4c50-b7b9-dde1c3774650 Co-authored-by: Amp --- cmd/bd/daemon.go | 2 +- cmd/bd/daemon_lock.go | 6 +++--- cmd/bd/delete.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/bd/daemon.go b/cmd/bd/daemon.go index 382ca075..f38fc280 100644 --- a/cmd/bd/daemon.go +++ b/cmd/bd/daemon.go @@ -599,7 +599,7 @@ func stopDaemon(pidFile string) { fmt.Fprintf(os.Stderr, "Error killing process: %v\n", err) } } - os.Remove(pidFile) + _ = os.Remove(pidFile) fmt.Println("Daemon killed") } } diff --git a/cmd/bd/daemon_lock.go b/cmd/bd/daemon_lock.go index 57195cbc..41a3e38f 100644 --- a/cmd/bd/daemon_lock.go +++ b/cmd/bd/daemon_lock.go @@ -41,7 +41,7 @@ func acquireDaemonLock(beadsDir string, global bool) (*DaemonLock, error) { // Try to acquire exclusive non-blocking lock if err := flockExclusive(f); err != nil { - f.Close() + _ = f.Close() if err == ErrDaemonLocked { return nil, ErrDaemonLocked } @@ -51,7 +51,7 @@ func acquireDaemonLock(beadsDir string, global bool) (*DaemonLock, error) { // Write our PID to the lock file for debugging (optional) _ = f.Truncate(0) _, _ = f.Seek(0, 0) - fmt.Fprintf(f, "%d\n", os.Getpid()) + _, _ = fmt.Fprintf(f, "%d\n", os.Getpid()) _ = f.Sync() // Also write PID file for Windows compatibility (can't read locked files on Windows) @@ -74,7 +74,7 @@ func tryDaemonLock(beadsDir string) (running bool, pid int) { // Fall back to PID file check for backward compatibility return checkPIDFile(beadsDir) } - defer f.Close() + defer func() { _ = f.Close() }() // Try to acquire lock non-blocking if err := flockExclusive(f); err != nil { diff --git a/cmd/bd/delete.go b/cmd/bd/delete.go index 13349254..3b52fbdd 100644 --- a/cmd/bd/delete.go +++ b/cmd/bd/delete.go @@ -70,7 +70,7 @@ Force: Delete and orphan dependents if len(issueIDs) == 0 { fmt.Fprintf(os.Stderr, "Error: no issue IDs provided\n") - cmd.Usage() + _ = cmd.Usage() os.Exit(1) } @@ -353,8 +353,8 @@ func removeIssueFromJSONL(issueID string) error { enc := json.NewEncoder(out) for _, iss := range issues { if err := enc.Encode(iss); err != nil { - out.Close() - os.Remove(temp) + _ = out.Close() + _ = os.Remove(temp) return fmt.Errorf("failed to write issue: %w", err) } }