Skip to content

fix: add error checking for unchecked return values#16

Open
korjavin wants to merge 2 commits into
masterfrom
fix/errcheck-issues
Open

fix: add error checking for unchecked return values#16
korjavin wants to merge 2 commits into
masterfrom
fix/errcheck-issues

Conversation

@korjavin

@korjavin korjavin commented Jan 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fix errcheck issues across the codebase by properly handling unchecked return values.

Changes

Error handling fixes:

  • conversation.go: Added error checking for tx.Rollback(), stmt.Close(), rows.Close() using deferred anonymous functions
  • elevenlabs.go: Added error checking for resp.Body.Close()
  • class_scheduler.go: Added error logging for cleanupOldClasses() return value
  • main.go: Added error logging for db.Close()
  • services.go: Added error checking for transaction and DB resource handling
  • stat_handler.go: Added blank identifier assignment for bot.Send() errors
  • cmd/tool-api/main.go: Added error checking for HTTP response handling
  • importer/importer.go: Added error checking for file.Close() and qdrantClient.Close()

Pattern used:

For deferred cleanup calls that can't meaningfully handle errors:

defer func() { _ = stmt.Close() }()

For inline calls where errors are intentionally ignored:

_, _ = bot.Send(msg)

Testing

All tests pass: go test ./...

Checklist

  • Code compiles without errors
  • All tests pass
  • No new linter warnings introduced
  • Changes follow existing code style

- Fix errcheck issues in main code files
- Add proper error handling for deferred Close() calls
- Use blank identifier pattern for intentionally ignored errors
- All tests pass (0.800s)

Files affected:
- conversation.go: tx.Rollback, stmt.Close, rows.Close
- elevenlabs.go: resp.Body.Close
- class_scheduler.go: cleanupOldClasses error
- main.go: db.Close
- services.go: transaction and DB resource handling
- stat_handler.go: bot.Send errors
- cmd/tool-api/main.go: HTTP response handling
- importer/importer.go: file and client close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant