From 2a1d98b87dd08b1b0d4553c8ba06ccb0d87f83f8 Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Tue, 16 Jan 2024 16:33:08 +0100 Subject: [PATCH] fix further golint issues --- driver/generic/query_executor.go | 2 +- driver/inmemory/eventstore.go | 2 +- .../projector_aggregate_bench_test.go | 3 +-- .../sql/projection_notification_processor.go | 2 +- driver/sql/projector_aggregate.go | 2 -- extension/amqp/amqp_test.go | 24 ++++--------------- extension/amqp/publisher.go | 2 +- strategy/json/sql/postgres/manager.go | 3 --- test/projector_aggregate_integration_test.go | 3 --- test/projector_integration_test.go | 4 ++-- 10 files changed, 12 insertions(+), 35 deletions(-) diff --git a/driver/generic/query_executor.go b/driver/generic/query_executor.go index b59e4aa..04b5034 100644 --- a/driver/generic/query_executor.go +++ b/driver/generic/query_executor.go @@ -50,7 +50,7 @@ func NewQueryExecutor(store goengine.EventStore, streamName goengine.StreamName, } // Reset sets the executor to it's initial state -func (e *QueryExecutor) Reset(ctx context.Context) { +func (e *QueryExecutor) Reset(context.Context) { e.state = nil e.offset = 0 } diff --git a/driver/inmemory/eventstore.go b/driver/inmemory/eventstore.go index 89625b4..0d65ddf 100644 --- a/driver/inmemory/eventstore.go +++ b/driver/inmemory/eventstore.go @@ -96,7 +96,7 @@ func (i *EventStore) Load( } // AppendTo appends the provided messages to the stream -func (i *EventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error { +func (i *EventStore) AppendTo(_ context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error { i.Lock() defer i.Unlock() diff --git a/driver/sql/postgres/projector_aggregate_bench_test.go b/driver/sql/postgres/projector_aggregate_bench_test.go index 4142030..d4129cd 100644 --- a/driver/sql/postgres/projector_aggregate_bench_test.go +++ b/driver/sql/postgres/projector_aggregate_bench_test.go @@ -46,7 +46,7 @@ type ( } ) -func (*personProjection) Init(ctx context.Context) (interface{}, error) { +func (*personProjection) Init(context.Context) (interface{}, error) { return nil, nil } @@ -183,7 +183,6 @@ func setup( }, goengine.NopLogger, driverSQL.NopMetrics, - 0, ) require.NoError(b, err, "failed to create aggregate projector") diff --git a/driver/sql/projection_notification_processor.go b/driver/sql/projection_notification_processor.go index 54bef4e..46a7ef1 100644 --- a/driver/sql/projection_notification_processor.go +++ b/driver/sql/projection_notification_processor.go @@ -58,7 +58,7 @@ func NewBackgroundProcessor( } // Execute starts the background worker and wait for the notification to be executed -func (b *ProjectionNotificationProcessor) Execute(ctx context.Context, handler ProcessHandler, notification *ProjectionNotification) error { +func (b *ProjectionNotificationProcessor) Execute(ctx context.Context, handler ProcessHandler, _ *ProjectionNotification) error { // Wrap the processNotification in order to know that the first trigger finished handler, handlerDone := b.wrapProcessHandlerForSingleRun(handler) diff --git a/driver/sql/projector_aggregate.go b/driver/sql/projector_aggregate.go index 4c170b3..76659f4 100644 --- a/driver/sql/projector_aggregate.go +++ b/driver/sql/projector_aggregate.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "sync" - "time" "github.com/hellofresh/goengine/v2" "github.com/hellofresh/goengine/v2/aggregate" @@ -36,7 +35,6 @@ func NewAggregateProjector( projectionErrorHandler ProjectionErrorCallback, logger goengine.Logger, metrics Metrics, - retryDelay time.Duration, ) (*AggregateProjector, error) { switch { case db == nil: diff --git a/extension/amqp/amqp_test.go b/extension/amqp/amqp_test.go index 514ded0..ccbbbaa 100644 --- a/extension/amqp/amqp_test.go +++ b/extension/amqp/amqp_test.go @@ -15,15 +15,15 @@ import ( type mockAcknowledger struct { } -func (ack mockAcknowledger) Ack(tag uint64, multiple bool) error { +func (ack mockAcknowledger) Ack(uint64, bool) error { return nil } -func (ack mockAcknowledger) Nack(tag uint64, multiple bool, requeue bool) error { +func (ack mockAcknowledger) Nack(uint64, bool, bool) error { return nil } -func (ack mockAcknowledger) Reject(tag uint64, requeue bool) error { +func (ack mockAcknowledger) Reject(uint64, bool) error { return nil } @@ -37,25 +37,11 @@ func (cn mockConnection) Close() error { return nil } -func (ch mockChannel) Publish( - exchange string, - queue string, - mandatory bool, - immediate bool, - msg amqp.Publishing, -) error { +func (ch mockChannel) Publish(string, string, bool, bool, amqp.Publishing) error { return nil } -func (ch mockChannel) Consume( - queue, - consumer string, - autoAck, - exclusive, - noLocal, - noWait bool, - args amqp.Table, -) (<-chan amqp.Delivery, error) { +func (ch mockChannel) Consume(string, string, bool, bool, bool, bool, amqp.Table) (<-chan amqp.Delivery, error) { return make(chan amqp.Delivery), nil } func (ch mockChannel) Qos(int, int, bool) error { diff --git a/extension/amqp/publisher.go b/extension/amqp/publisher.go index 557d51c..34dcc91 100644 --- a/extension/amqp/publisher.go +++ b/extension/amqp/publisher.go @@ -58,7 +58,7 @@ func NewNotificationPublisher( } // Publish sends a ProjectionNotification to Queue -func (p *NotificationPublisher) Publish(ctx context.Context, notification *sql.ProjectionNotification) error { +func (p *NotificationPublisher) Publish(_ context.Context, notification *sql.ProjectionNotification) error { reconnectInterval := p.minReconnectInterval // Ignore nil notifications since this is not supported // Skipping as we may receive a nil notification from dispatcher for the first time diff --git a/strategy/json/sql/postgres/manager.go b/strategy/json/sql/postgres/manager.go index 7f5fe62..12b1b81 100644 --- a/strategy/json/sql/postgres/manager.go +++ b/strategy/json/sql/postgres/manager.go @@ -2,7 +2,6 @@ package postgres import ( "database/sql" - "time" "github.com/hellofresh/goengine/v2" driverSQL "github.com/hellofresh/goengine/v2/driver/sql" @@ -121,7 +120,6 @@ func (m *SingleStreamManager) NewAggregateProjector( projection goengine.Projection, projectionErrorHandler driverSQL.ProjectionErrorCallback, useLockedField bool, - retryDelay time.Duration, ) (*driverSQL.AggregateProjector, error) { eventStore, err := m.NewEventStore() if err != nil { @@ -153,6 +151,5 @@ func (m *SingleStreamManager) NewAggregateProjector( projectionErrorHandler, m.logger, m.metrics, - retryDelay, ) } diff --git a/test/projector_aggregate_integration_test.go b/test/projector_aggregate_integration_test.go index 753753b..d14b4f4 100644 --- a/test/projector_aggregate_integration_test.go +++ b/test/projector_aggregate_integration_test.go @@ -112,7 +112,6 @@ func (s *aggregateProjectorTestSuite) TestRunAndListen() { }, s.GetLogger(), s.Metrics, - 0, ) s.Require().NoError(err, "failed to create projector") @@ -211,7 +210,6 @@ func (s *aggregateProjectorTestSuite) TestRunAndListen() { }, s.GetLogger(), s.Metrics, - 0, ) s.Require().NoError(err, "failed to create projector") @@ -267,7 +265,6 @@ func (s *aggregateProjectorTestSuite) TestRun() { }, s.GetLogger(), s.Metrics, - 0, ) s.Require().NoError(err, "failed to create projector") diff --git a/test/projector_integration_test.go b/test/projector_integration_test.go index a25b20f..81db0df 100644 --- a/test/projector_integration_test.go +++ b/test/projector_integration_test.go @@ -41,7 +41,7 @@ type ( } ) -func (p *DepositedProjection) Init(ctx context.Context) (interface{}, error) { +func (p *DepositedProjection) Init(context.Context) (interface{}, error) { return depositedProjectionState{}, nil } @@ -119,7 +119,7 @@ func (s *projectorSuite) SetupTest() { err = s.eventStore.Create(ctx, s.eventStream) s.Require().NoError(err, "failed on create event stream") - // Setup the projection tables etc. + // Set up the projection tables etc. s.eventStoreTable, err = persistenceStrategy.GenerateTableName(s.eventStream) s.Require().NoError(err, "failed to generate eventstream table name") }