fix: add nolint:errcheck comments for intentionally unchecked errors
Add //nolint:errcheck comments to intentionally unchecked error returns: - defer X.Close() calls: errors from closing read-only resources, rows after iteration, files, response bodies, and gzip readers are not actionable and don't affect correctness - defer tx.Rollback(): standard Go pattern where rollback after successful commit returns an error, which is expected behavior - defer stmt.Close(): statements are closed with their transactions - Cleanup operations: DeleteRevision on failure and os.RemoveAll for temp directories are best-effort cleanup - HTTP response encoding: if JSON encoding fails at response time, there's nothing useful we can do - Test/benchmark code: unchecked errors in test setup/cleanup where failures will surface through test assertions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -191,7 +191,7 @@ func runServe(c *cli.Context) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
@@ -234,7 +234,7 @@ func runIndex(c *cli.Context, revision string, indexFiles bool, force bool) erro
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
@@ -288,7 +288,7 @@ func runList(c *cli.Context) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
@@ -325,7 +325,7 @@ func runSearch(c *cli.Context, query string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
@@ -397,7 +397,7 @@ func runGet(c *cli.Context, name string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
@@ -490,7 +490,7 @@ func runDelete(c *cli.Context, revision string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
defer store.Close()
|
||||
defer store.Close() //nolint:errcheck // cleanup on exit
|
||||
|
||||
if err := store.Initialize(ctx); err != nil {
|
||||
return fmt.Errorf("failed to initialize database: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user