Skip to content

Commit

Permalink
GODRIVER-2690 Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvasquez committed Sep 14, 2023
1 parent 3a05351 commit 648b34d
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions benchmark/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func MultiFindMany(ctx context.Context, tm TimerManager, iters int) error {
if err != nil {
return err
}
defer db.Client().Disconnect(ctx)
defer func() { _ = db.Client().Disconnect(ctx) }()

db = db.Client().Database("perftest")
if err = db.Drop(ctx); err != nil {
Expand Down Expand Up @@ -87,7 +87,7 @@ func multiInsertCase(ctx context.Context, tm TimerManager, iters int, data strin
if err != nil {
return err
}
defer db.Client().Disconnect(ctx)
defer func() { _ = db.Client().Disconnect(ctx) }()

db = db.Client().Database("perftest")
if err = db.Drop(ctx); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions benchmark/operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func BenchmarkClientWrite(b *testing.B) {
if err != nil {
b.Fatalf("error connecting: %v", err)
}
defer client.Disconnect(context.Background())
defer func() { _ = client.Disconnect(context.Background()) }()
coll := client.Database("test").Collection("test")
_, err = coll.DeleteMany(context.Background(), bson.D{})
if err != nil {
Expand Down Expand Up @@ -85,7 +85,7 @@ func BenchmarkClientBulkWrite(b *testing.B) {
if err != nil {
b.Fatalf("error connecting: %v", err)
}
defer client.Disconnect(context.Background())
defer func() { _ = client.Disconnect(context.Background()) }()
coll := client.Database("test").Collection("test")
_, err = coll.DeleteMany(context.Background(), bson.D{})
if err != nil {
Expand Down Expand Up @@ -134,7 +134,7 @@ func BenchmarkClientRead(b *testing.B) {
if err != nil {
b.Fatalf("error connecting: %v", err)
}
defer client.Disconnect(context.Background())
defer func() { _ = client.Disconnect(context.Background()) }()
coll := client.Database("test").Collection("test")
_, err = coll.DeleteMany(context.Background(), bson.D{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func SingleRunCommand(ctx context.Context, tm TimerManager, iters int) error {
if err != nil {
return err
}
defer db.Client().Disconnect(ctx)
defer func() { _ = db.Client().Disconnect(ctx) }()

cmd := bson.D{{handshake.LegacyHelloLowercase, true}}

Expand Down Expand Up @@ -130,7 +130,7 @@ func singleInsertCase(ctx context.Context, tm TimerManager, iters int, data stri
if err != nil {
return err
}
defer db.Client().Disconnect(ctx)
defer func() { _ = db.Client().Disconnect(ctx) }()

db = db.Client().Database("perftest")
if err = db.Drop(ctx); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/testkms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func main() {
if err != nil {
panic(fmt.Sprintf("Connect error: %v", err))
}
defer keyVaultClient.Disconnect(context.Background())
defer func() { _ = keyVaultClient.Disconnect(context.Background()) }()

kmsProvidersMap := map[string]map[string]interface{}{
provider: {},
Expand Down
4 changes: 2 additions & 2 deletions mongo/crud_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ func ExampleCollection_Find_primitiveRegex() {
panic(err)
}

defer client.Disconnect(ctx)
defer func() { _ = client.Disconnect(ctx) }()

type Pet struct {
Type string `bson:"type"`
Expand Down Expand Up @@ -1126,7 +1126,7 @@ func ExampleCollection_Find_regex() {
panic(err)
}

defer client.Disconnect(ctx)
defer func() { _ = client.Disconnect(ctx) }()

type Pet struct {
Type string `bson:"type"`
Expand Down
2 changes: 1 addition & 1 deletion mongo/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestDatabase(t *testing.T) {
t.Run("TransientTransactionError label", func(t *testing.T) {
client := setupClient(options.Client().ApplyURI("mongodb://nonexistent").SetServerSelectionTimeout(3 * time.Second))
err := client.Connect(bgCtx)
defer client.Disconnect(bgCtx)
defer func() { _ = client.Disconnect(bgCtx) }()
assert.Nil(t, err, "expected nil, got %v", err)

t.Run("negative case of non-transaction", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion mongo/integration/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestErrors(t *testing.T) {
integtest.AddTestServerAPIVersion(clientOpts)
client, err := mongo.Connect(context.Background(), clientOpts)
assert.Nil(mt, err, "Connect error: %v", err)
defer client.Disconnect(context.Background())
defer func() { _ = client.Disconnect(context.Background()) }()

// A connection getting closed should manifest as an io.EOF error.
err = client.Ping(context.Background(), mtest.PrimaryRp)
Expand Down
2 changes: 1 addition & 1 deletion mongo/integration/unified/admin_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func runCommandOnHost(ctx context.Context, host string, commandFn func(context.C
if err != nil {
return fmt.Errorf("error creating client to host %q: %v", host, err)
}
defer client.Disconnect(ctx)
defer func() { _ = client.Disconnect(ctx) }()

return commandFn(ctx, client)
}
Expand Down
4 changes: 2 additions & 2 deletions mongo/ocsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestOCSP(t *testing.T) {
clientOpts := createOCSPClientOptions(cs.Original)
client, err := Connect(bgCtx, clientOpts)
assert.Nil(t, err, "Connect error: %v", err)
defer client.Disconnect(bgCtx)
defer func() { _ = client.Disconnect(bgCtx) }()

err = client.Ping(bgCtx, readpref.Primary())
if shouldSucceed {
Expand All @@ -49,7 +49,7 @@ func TestOCSP(t *testing.T) {
clientOpts := createInsecureOCSPClientOptions(cs.Original)
client, err := Connect(bgCtx, clientOpts)
assert.Nil(t, err, "Connect error: %v", err)
defer client.Disconnect(bgCtx)
defer func() { _ = client.Disconnect(bgCtx) }()

err = client.Ping(bgCtx, readpref.Primary())
assert.Nil(t, err, "Ping error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion mongo/options/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func ExampleClientOptions_SetLoggerOptions_customLogger() {
log.Fatalf("error connecting to MongoDB: %v", err)
}

defer client.Disconnect(context.TODO())
defer func() { _ = client.Disconnect(context.TODO()) }()

// Make a database request to test our logging solution.
coll := client.Database("test").Collection("test")
Expand Down
2 changes: 1 addition & 1 deletion x/mongo/driver/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func (t *Topology) SelectServer(ctx context.Context, ss description.ServerSelect

return nil, err
}
defer t.Unsubscribe(sub)
defer func() { _ = t.Unsubscribe(sub) }()
}

suitable, selectErr = t.selectServerFromSubscription(ctx, sub.Updates, selectionState)
Expand Down

0 comments on commit 648b34d

Please sign in to comment.