Skip to content

Commit f5bff13

Browse files
authored
fix(client): eliminate unreachable code in Close method
fix(client): eliminate unreachable code in Close method
2 parents 4989efd + 6edd569 commit f5bff13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/app/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ func (c *PostgreSQLClientImpl) Connect(connectionString string) error {
4040

4141
// Close closes the database connection.
4242
func (c *PostgreSQLClientImpl) Close() error {
43-
if c.db != nil {
44-
if err := c.db.Close(); err != nil {
45-
return fmt.Errorf("failed to close database: %w", err)
46-
}
43+
if c.db == nil {
4744
return nil
4845
}
46+
if err := c.db.Close(); err != nil {
47+
return fmt.Errorf("failed to close database: %w", err)
48+
}
4949
return nil
5050
}
5151

0 commit comments

Comments
 (0)