diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb873a9e54..0449e06e50 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: exclude: ^(vendor) - repo: https://github.com/golangci/golangci-lint - rev: v1.59.1 + rev: v1.60.1 hooks: - id: golangci-lint @@ -61,4 +61,4 @@ repos: name: executable-shell entry: chmod +x language: system - types: [shell] \ No newline at end of file + types: [shell] diff --git a/Taskfile.yml b/Taskfile.yml index 7f955eb6ec..a08d20f4ca 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -194,4 +194,4 @@ tasks: install-golangci-lint: internal: true cmds: - - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 \ No newline at end of file + - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1 diff --git a/internal/integration/unified/event_verification.go b/internal/integration/unified/event_verification.go index 56776d63f5..ebdb0b19c3 100644 --- a/internal/integration/unified/event_verification.go +++ b/internal/integration/unified/event_verification.go @@ -314,16 +314,16 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro switch { case evt.ConnectionCreatedEvent != nil: if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCreated); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } case evt.ConnectionReadyEvent != nil: if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionReady); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } case evt.ConnectionClosedEvent != nil: var actual *event.PoolEvent if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionClosed); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } if expectedReason := evt.ConnectionClosedEvent.Reason; expectedReason != nil { @@ -333,12 +333,12 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro } case evt.ConnectionCheckedOutEvent != nil: if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckedOut); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } case evt.ConnectionCheckOutFailedEvent != nil: var actual *event.PoolEvent if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckOutFailed); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } if expectedReason := evt.ConnectionCheckOutFailedEvent.Reason; expectedReason != nil { @@ -348,12 +348,12 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro } case evt.ConnectionCheckedInEvent != nil: if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckedIn); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } case evt.PoolClearedEvent != nil: var actual *event.PoolEvent if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionPoolCleared); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error()) } if expectServiceID := evt.PoolClearedEvent.HasServiceID; expectServiceID != nil { if err := verifyServiceID(*expectServiceID, actual.ServiceID); err != nil { @@ -513,7 +513,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro case evt.ServerDescriptionChangedEvent != nil: var got *event.ServerDescriptionChangedEvent if got, changed, err = getNextServerDescriptionChangedEvent(changed); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next server description changed event: %v", err.Error()) } prevDesc := evt.ServerDescriptionChangedEvent.NewDescription @@ -544,7 +544,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro case evt.ServerHeartbeatStartedEvent != nil: var got *event.ServerHeartbeatStartedEvent if got, started, err = getNextServerHeartbeatStartedEvent(started); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next server heartbeat started event: %v", err.Error()) } if want := evt.ServerHeartbeatStartedEvent.Awaited; want != nil && *want != got.Awaited { @@ -553,7 +553,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro case evt.ServerHeartbeatSucceededEvent != nil: var got *event.ServerHeartbeatSucceededEvent if got, succeeded, err = getNextServerHeartbeatSucceededEvent(succeeded); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next server heartbeat succeeded event: %v", err.Error()) } if want := evt.ServerHeartbeatSucceededEvent.Awaited; want != nil && *want != got.Awaited { @@ -562,7 +562,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro case evt.ServerHeartbeatFailedEvent != nil: var got *event.ServerHeartbeatFailedEvent if got, failed, err = getNextServerHeartbeatFailedEvent(failed); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next server heartbeat failed event: %v", err.Error()) } if want := evt.ServerHeartbeatFailedEvent.Awaited; want != nil && *want != got.Awaited { @@ -570,7 +570,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro } case evt.TopologyDescriptionChangedEvent != nil: if _, tchanged, err = getNextTopologyDescriptionChangedEvent(tchanged); err != nil { - return newEventVerificationError(idx, client, err.Error()) + return newEventVerificationError(idx, client, "failed to get next description changed event: %v", err.Error()) } } } diff --git a/mongo/client.go b/mongo/client.go index d7dc15fcc7..9bdff78a9f 100644 --- a/mongo/client.go +++ b/mongo/client.go @@ -909,9 +909,7 @@ func newLogger(opts options.Lister[options.LoggerOptions]) (*logger.Logger, erro // If there are no component-level options and the environment does not // contain component variables, then do nothing. - if (args.ComponentLevels == nil || len(args.ComponentLevels) == 0) && - !logger.EnvHasComponentVariables() { - + if len(args.ComponentLevels) == 0 && !logger.EnvHasComponentVariables() { return nil, nil }