Skip to content

Commit

Permalink
Merge pull request #91 from hellofresh/patch/fix-golint
Browse files Browse the repository at this point in the history
fix further golint issues
  • Loading branch information
s-radyuk authored Jan 16, 2024
2 parents 7ef95e6 + 2a1d98b commit 95cacba
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion driver/generic/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion driver/inmemory/eventstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 1 addition & 2 deletions driver/sql/postgres/projector_aggregate_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type (
}
)

func (*personProjection) Init(ctx context.Context) (interface{}, error) {
func (*personProjection) Init(context.Context) (interface{}, error) {
return nil, nil
}

Expand Down Expand Up @@ -183,7 +183,6 @@ func setup(
},
goengine.NopLogger,
driverSQL.NopMetrics,
0,
)
require.NoError(b, err, "failed to create aggregate projector")

Expand Down
2 changes: 1 addition & 1 deletion driver/sql/projection_notification_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions driver/sql/projector_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"sync"
"time"

"github.com/hellofresh/goengine/v2"
"github.com/hellofresh/goengine/v2/aggregate"
Expand Down Expand Up @@ -36,7 +35,6 @@ func NewAggregateProjector(
projectionErrorHandler ProjectionErrorCallback,
logger goengine.Logger,
metrics Metrics,
retryDelay time.Duration,
) (*AggregateProjector, error) {
switch {
case db == nil:
Expand Down
24 changes: 5 additions & 19 deletions extension/amqp/amqp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion extension/amqp/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions strategy/json/sql/postgres/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package postgres

import (
"database/sql"
"time"

"github.com/hellofresh/goengine/v2"
driverSQL "github.com/hellofresh/goengine/v2/driver/sql"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -153,6 +151,5 @@ func (m *SingleStreamManager) NewAggregateProjector(
projectionErrorHandler,
m.logger,
m.metrics,
retryDelay,
)
}
3 changes: 0 additions & 3 deletions test/projector_aggregate_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func (s *aggregateProjectorTestSuite) TestRunAndListen() {
},
s.GetLogger(),
s.Metrics,
0,
)
s.Require().NoError(err, "failed to create projector")

Expand Down Expand Up @@ -211,7 +210,6 @@ func (s *aggregateProjectorTestSuite) TestRunAndListen() {
},
s.GetLogger(),
s.Metrics,
0,
)
s.Require().NoError(err, "failed to create projector")

Expand Down Expand Up @@ -267,7 +265,6 @@ func (s *aggregateProjectorTestSuite) TestRun() {
},
s.GetLogger(),
s.Metrics,
0,
)
s.Require().NoError(err, "failed to create projector")

Expand Down
4 changes: 2 additions & 2 deletions test/projector_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 95cacba

Please sign in to comment.