Fix lint errors related to not checking errors

This commit is contained in:
Eli Ribble 2026-05-02 00:37:28 +00:00
parent 7f71ff9a2e
commit 52d4c47e43
No known key found for this signature in database
7 changed files with 54 additions and 10 deletions

View file

@ -76,7 +76,12 @@ func doMigrations(connection_string string) error {
if err != nil {
return fmt.Errorf("Failed to open database connection: %w", err)
}
defer db.Close()
defer func() {
err := db.Close()
if err != nil {
log.Error().Err(err).Msg("failed to close database connection")
}
}()
row := db.QueryRowContext(context.Background(), "SELECT version()")
var val string
if err := row.Scan(&val); err != nil {
@ -157,7 +162,12 @@ func needsMigrations(connection_string string) (*bool, error) {
if err != nil {
return nil, fmt.Errorf("Failed to open database connection: %w", err)
}
defer db.Close()
defer func() {
err := db.Close()
if err != nil {
log.Error().Err(err).Msg("failed to close database connection")
}
}()
row := db.QueryRowContext(context.Background(), "SELECT version()")
var val string
if err := row.Scan(&val); err != nil {