Enable errcheck linter and fix all production code warnings
- Enabled errcheck linter (previously disabled)
- Set tests: false in .golangci.yml to focus on production code
- Fixed 27 errcheck warnings using Go best practices:
* Database resources: defer func() { _ = rows.Close() }()
* Transaction rollbacks: defer func() { _ = tx.Rollback() }()
* Best-effort closers: _ = store.Close(), _ = client.Close()
* File writes: proper error checking on Close()
* Interactive input: handle EOF gracefully
* File ops: ignore ENOENT on os.Remove()
- All tests pass
- Closes bd-58
Amp-Thread-ID: https://ampcode.com/threads/T-57c9afd3-9adf-40c2-8be7-3e493d200361
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -107,7 +107,7 @@ func (s *SQLiteStorage) GetReadyWork(ctx context.Context, filter types.WorkFilte
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get ready work: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
return s.scanIssues(ctx, rows)
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func (s *SQLiteStorage) GetBlockedIssues(ctx context.Context) ([]*types.BlockedI
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get blocked issues: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
var blocked []*types.BlockedIssue
|
||||
for rows.Next() {
|
||||
|
||||
Reference in New Issue
Block a user