fix: resolve golangci-lint warnings
- Handle ignored errors with explicit _ assignment (errcheck) - Add #nosec comments for false positive G304/G204 warnings (gosec) - Fix misspelling: cancelled -> canceled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1019,7 +1019,7 @@ func pruneExpiredTombstones() (*TombstonePruneResult, error) {
|
||||
}
|
||||
allIssues = append(allIssues, &issue)
|
||||
}
|
||||
file.Close()
|
||||
_ = file.Close() // Best effort close, already read all data
|
||||
|
||||
// Determine TTL
|
||||
ttl := types.DefaultTombstoneTTL
|
||||
@@ -1052,20 +1052,20 @@ func pruneExpiredTombstones() (*TombstonePruneResult, error) {
|
||||
encoder := json.NewEncoder(tempFile)
|
||||
for _, issue := range kept {
|
||||
if err := encoder.Encode(issue); err != nil {
|
||||
tempFile.Close()
|
||||
os.Remove(tempPath)
|
||||
_ = tempFile.Close()
|
||||
_ = os.Remove(tempPath) // Best effort cleanup
|
||||
return nil, fmt.Errorf("failed to write issue %s: %w", issue.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := tempFile.Close(); err != nil {
|
||||
os.Remove(tempPath)
|
||||
_ = os.Remove(tempPath) // Best effort cleanup
|
||||
return nil, fmt.Errorf("failed to close temp file: %w", err)
|
||||
}
|
||||
|
||||
// Atomically replace
|
||||
if err := os.Rename(tempPath, issuesPath); err != nil {
|
||||
os.Remove(tempPath)
|
||||
_ = os.Remove(tempPath) // Best effort cleanup
|
||||
return nil, fmt.Errorf("failed to replace issues.jsonl: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Examples:
|
||||
existingTombstones[issue.ID] = true
|
||||
}
|
||||
}
|
||||
file.Close()
|
||||
_ = file.Close()
|
||||
}
|
||||
|
||||
// Determine which deletions need migration
|
||||
|
||||
@@ -139,7 +139,7 @@ EXAMPLES:
|
||||
|
||||
response = strings.TrimSpace(strings.ToLower(response))
|
||||
if response != "y" && response != "yes" {
|
||||
fmt.Printf("Reset cancelled.\n")
|
||||
fmt.Printf("Reset canceled.\n")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,7 @@ func isClaudeSetupComplete() bool {
|
||||
|
||||
// Check if beads plugin is installed - plugin now provides hooks automatically
|
||||
settingsPath := filepath.Join(home, ".claude", "settings.json")
|
||||
// #nosec G304 -- settingsPath is constructed from user home dir, not user input
|
||||
if data, err := os.ReadFile(settingsPath); err == nil {
|
||||
var settings map[string]interface{}
|
||||
if err := json.Unmarshal(data, &settings); err == nil {
|
||||
@@ -287,7 +288,7 @@ func isClaudeSetupComplete() bool {
|
||||
|
||||
// hasBeadsPrimeHooks checks if a settings file has bd prime hooks configured
|
||||
func hasBeadsPrimeHooks(settingsPath string) bool {
|
||||
data, err := os.ReadFile(settingsPath)
|
||||
data, err := os.ReadFile(settingsPath) // #nosec G304 -- path is either from home dir or relative project path
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func GitRemoveBeads(beadsDir string) error {
|
||||
// Try to remove each file (git rm ignores non-existent files with --ignore-unmatch)
|
||||
// Use --force to handle files with staged changes
|
||||
for _, file := range jsonlFiles {
|
||||
cmd := exec.Command("git", "rm", "--ignore-unmatch", "--quiet", "--force", file)
|
||||
cmd := exec.Command("git", "rm", "--ignore-unmatch", "--quiet", "--force", file) // #nosec G204 -- git is a constant, file is from controlled source
|
||||
var stderr bytes.Buffer
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func CountImpact() (*ImpactSummary, error) {
|
||||
ctx := context.Background()
|
||||
store, err := sqlite.New(ctx, dbPath)
|
||||
if err == nil {
|
||||
defer store.Close()
|
||||
defer func() { _ = store.Close() }()
|
||||
|
||||
// Count all issues including tombstones
|
||||
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{IncludeTombstones: true})
|
||||
|
||||
@@ -1178,12 +1178,12 @@ func (s *SQLiteStorage) executeDelete(ctx context.Context, tx *sql.Tx, inClause
|
||||
for rows.Next() {
|
||||
var id, issueType string
|
||||
if err := rows.Scan(&id, &issueType); err != nil {
|
||||
rows.Close()
|
||||
_ = rows.Close()
|
||||
return fmt.Errorf("failed to scan issue type: %w", err)
|
||||
}
|
||||
issueTypes[id] = issueType
|
||||
}
|
||||
rows.Close()
|
||||
_ = rows.Close()
|
||||
|
||||
// 3. Convert issues to tombstones (only for issues that exist)
|
||||
now := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user