From 52f3363b0f675c84ebc53d5bb63e6105e1f58624 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Tue, 16 Dec 2025 17:50:25 -0800 Subject: [PATCH] fix: resolve all golangci-lint errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - errcheck: explicitly discard error returns for git config --unset - gosec G304: add nolint for safe file read from hardcoded list - gosec G306: add nolint for .gitattributes (must be world-readable) - unparam: remove unused gitDir param, use _ for unused ctx - unparam: change functions with always-nil error returns to void 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/bd/init.go | 10 +++------- cmd/bd/reset.go | 7 ++++--- cmd/bd/sync.go | 12 ++++-------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/cmd/bd/init.go b/cmd/bd/init.go index 0c29f69d..e94307f4 100644 --- a/cmd/bd/init.go +++ b/cmd/bd/init.go @@ -426,10 +426,7 @@ With --stealth: configures global git settings for invisible beads usage: // Add "landing the plane" instructions to AGENTS.md and @AGENTS.md // Skip in stealth mode (user wants invisible setup) and quiet mode (suppress all output) if !stealth { - if err := addLandingThePlaneInstructions(!quiet); err != nil && !quiet { - yellow := color.New(color.FgYellow).SprintFunc() - fmt.Fprintf(os.Stderr, "%s Failed to add landing-the-plane instructions: %v\n", yellow("⚠"), err) - } + addLandingThePlaneInstructions(!quiet) } // Skip output if quiet mode @@ -1590,7 +1587,7 @@ const landingThePlaneSection = ` ` // addLandingThePlaneInstructions adds "landing the plane" instructions to AGENTS.md and @AGENTS.md -func addLandingThePlaneInstructions(verbose bool) error { +func addLandingThePlaneInstructions(verbose bool) { // Files to update (AGENTS.md and @AGENTS.md for web Claude) agentFiles := []string{"AGENTS.md", "@AGENTS.md"} @@ -1602,13 +1599,12 @@ func addLandingThePlaneInstructions(verbose bool) error { } } } - - return nil } // updateAgentFile creates or updates an agent instructions file with landing the plane section func updateAgentFile(filename string, verbose bool) error { // Check if file exists + //nolint:gosec // G304: filename comes from hardcoded list in addLandingThePlaneInstructions content, err := os.ReadFile(filename) if os.IsNotExist(err) { // File doesn't exist - create it with basic structure diff --git a/cmd/bd/reset.go b/cmd/bd/reset.go index 2b597250..7f4042b5 100644 --- a/cmd/bd/reset.go +++ b/cmd/bd/reset.go @@ -227,7 +227,7 @@ func showResetPreview(items []resetItem) { fmt.Printf("To proceed, run: %s\n", yellow("bd reset --force")) } -func performReset(items []resetItem, gitDir, beadsDir string) { +func performReset(items []resetItem, _, beadsDir string) { green := color.New(color.FgGreen).SprintFunc() var errors []string @@ -257,8 +257,8 @@ func performReset(items []resetItem, gitDir, beadsDir string) { case "config": // Remove merge driver config (ignore errors - may not exist) - exec.Command("git", "config", "--unset", "merge.beads.driver").Run() - exec.Command("git", "config", "--unset", "merge.beads.name").Run() + _ = exec.Command("git", "config", "--unset", "merge.beads.driver").Run() + _ = exec.Command("git", "config", "--unset", "merge.beads.name").Run() if !jsonOutput { fmt.Printf("%s Removed merge driver config\n", green("✓")) } @@ -363,5 +363,6 @@ func removeGitattributesEntry() error { // Add single trailing newline newContent += "\n" + //nolint:gosec // G306: .gitattributes must be world-readable (0644) return os.WriteFile(".gitattributes", []byte(newContent), 0644) } diff --git a/cmd/bd/sync.go b/cmd/bd/sync.go index 370e5ab9..e1eeef9e 100644 --- a/cmd/bd/sync.go +++ b/cmd/bd/sync.go @@ -90,10 +90,7 @@ Use --merge to merge the sync branch back to main branch.`, // If check mode, run pre-sync integrity checks (bd-hlsw.1) if checkIntegrity { - if err := showSyncIntegrityCheck(ctx, jsonlPath); err != nil { - fmt.Fprintf(os.Stderr, "Error: %v\n", err) - os.Exit(1) - } + showSyncIntegrityCheck(ctx, jsonlPath) return } @@ -836,7 +833,7 @@ func gitHasChanges(ctx context.Context, filePath string) (bool, error) { // getRepoRootForWorktree returns the main repository root for running git commands // This is always the main repository root, never the worktree root -func getRepoRootForWorktree(ctx context.Context) string { +func getRepoRootForWorktree(_ context.Context) string { repoRoot, err := git.GetMainRepoRoot() if err != nil { // Fallback to current directory if GetMainRepoRoot fails @@ -1797,7 +1794,8 @@ type OrphanedChildren struct { // showSyncIntegrityCheck performs pre-sync integrity checks without modifying state. // bd-hlsw.1: Detects forced pushes, prefix mismatches, and orphaned children. -func showSyncIntegrityCheck(ctx context.Context, jsonlPath string) error { +// Exits with code 1 if problems are detected. +func showSyncIntegrityCheck(ctx context.Context, jsonlPath string) { fmt.Println("Sync Integrity Check") fmt.Println("====================") @@ -1858,8 +1856,6 @@ func showSyncIntegrityCheck(ctx context.Context, jsonlPath string) error { data, _ := json.MarshalIndent(result, "", " ") fmt.Println(string(data)) } - - return nil } // checkForcedPush detects if the sync branch has diverged from remote.