diff --git a/pkg/detectors/mongodb/mongodb.go b/pkg/detectors/mongodb/mongodb.go index 7b1d3bcb7cb7..208c4744b8e8 100644 --- a/pkg/detectors/mongodb/mongodb.go +++ b/pkg/detectors/mongodb/mongodb.go @@ -86,9 +86,7 @@ func verifyUri(uri string, timeout time.Duration) error { if err != nil { return err } - defer func() { - _ = client.Disconnect(ctx) - }() + defer client.Disconnect(ctx) return client.Ping(ctx, readpref.Primary()) }