Fix lint errors related to not checking errors
This commit is contained in:
parent
7f71ff9a2e
commit
52d4c47e43
7 changed files with 54 additions and 10 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue