fix: resolve all golangci-lint errors

- 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 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-16 17:50:25 -08:00
parent a6f0c2d497
commit 52f3363b0f
3 changed files with 11 additions and 18 deletions

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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.