From 9c7e8340ed503439d2c13b1699be81dcb2c337be Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Thu, 11 Jan 2024 13:04:28 +0100 Subject: [PATCH 1/5] rename unused vars --- driver/inmemory/eventstore.go | 6 +++--- extension/amqp/amqp_test.go | 2 +- logger_nop.go | 10 +++++----- metadata/matcher.go | 2 +- metadata/metadata.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/driver/inmemory/eventstore.go b/driver/inmemory/eventstore.go index 00ff6e56..89625b4e 100644 --- a/driver/inmemory/eventstore.go +++ b/driver/inmemory/eventstore.go @@ -38,7 +38,7 @@ func NewEventStore(logger goengine.Logger) *EventStore { } // Create creates an event stream -func (i *EventStore) Create(ctx context.Context, streamName goengine.StreamName) error { +func (i *EventStore) Create(_ context.Context, streamName goengine.StreamName) error { if _, found := i.streams[streamName]; found { return ErrStreamExistsAlready } @@ -49,7 +49,7 @@ func (i *EventStore) Create(ctx context.Context, streamName goengine.StreamName) } // HasStream returns true if the stream exists -func (i *EventStore) HasStream(ctx context.Context, streamName goengine.StreamName) bool { +func (i *EventStore) HasStream(_ context.Context, streamName goengine.StreamName) bool { _, found := i.streams[streamName] return found @@ -57,7 +57,7 @@ func (i *EventStore) HasStream(ctx context.Context, streamName goengine.StreamNa // Load returns a list of events based on the provided conditions func (i *EventStore) Load( - ctx context.Context, + _ context.Context, streamName goengine.StreamName, fromNumber int64, count *uint, diff --git a/extension/amqp/amqp_test.go b/extension/amqp/amqp_test.go index f41c13f5..c2df55b6 100644 --- a/extension/amqp/amqp_test.go +++ b/extension/amqp/amqp_test.go @@ -58,7 +58,7 @@ func (ch mockChannel) Consume( ) (<-chan amqp.Delivery, error) { return make(chan amqp.Delivery), nil } -func (ch mockChannel) Qos(prefetchCount, prefetchSize int, global bool) error { +func (ch mockChannel) Qos(_, prefetchSize int, global bool) error { return nil } diff --git a/logger_nop.go b/logger_nop.go index 60b335bf..80cf8b99 100644 --- a/logger_nop.go +++ b/logger_nop.go @@ -8,18 +8,18 @@ var NopLogger Logger = &nopLogger{} type nopLogger struct { } -func (nopLogger) Error(msg string, fields func(LoggerEntry)) { +func (nopLogger) Error(_ string, _ func(LoggerEntry)) { } -func (nopLogger) Warn(msg string, fields func(LoggerEntry)) { +func (nopLogger) Warn(_ string, _ func(LoggerEntry)) { } -func (nopLogger) Info(msg string, fields func(LoggerEntry)) { +func (nopLogger) Info(_ string, _ func(LoggerEntry)) { } -func (nopLogger) Debug(msg string, fields func(LoggerEntry)) { +func (nopLogger) Debug(_ string, _ func(LoggerEntry)) { } -func (n *nopLogger) WithFields(fields func(LoggerEntry)) Logger { +func (n *nopLogger) WithFields(_ func(LoggerEntry)) Logger { return n } diff --git a/metadata/matcher.go b/metadata/matcher.go index 4cf6faf0..0082ae38 100644 --- a/metadata/matcher.go +++ b/metadata/matcher.go @@ -65,7 +65,7 @@ func WithConstraint(parent Matcher, field string, operator Operator, value inter } } -func (*emptyMatcher) Iterate(callback func(constraint Constraint)) { +func (*emptyMatcher) Iterate(_ func(constraint Constraint)) { } func (c *constraintMatcher) Iterate(callback func(constraint Constraint)) { diff --git a/metadata/metadata.go b/metadata/metadata.go index 03a81547..05b856a3 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -63,7 +63,7 @@ var ( _ easyjson.Marshaler = new(emptyData) ) -func (*emptyData) Value(key string) interface{} { +func (*emptyData) Value(_ string) interface{} { return nil } From 1ac58bfa8913f2f8476dc206a7e79c45c62b8d59 Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Thu, 11 Jan 2024 13:06:57 +0100 Subject: [PATCH 2/5] rename unused vars --- extension/amqp/amqp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/amqp/amqp_test.go b/extension/amqp/amqp_test.go index c2df55b6..9600e935 100644 --- a/extension/amqp/amqp_test.go +++ b/extension/amqp/amqp_test.go @@ -58,7 +58,7 @@ func (ch mockChannel) Consume( ) (<-chan amqp.Delivery, error) { return make(chan amqp.Delivery), nil } -func (ch mockChannel) Qos(_, prefetchSize int, global bool) error { +func (ch mockChannel) Qos(_, _ int, global bool) error { return nil } From 6a8793df323bb0687849a5932e783372ff2a3fa0 Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Thu, 11 Jan 2024 13:09:49 +0100 Subject: [PATCH 3/5] update golangci-lint-action version in testing workflow --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index bff22e98..40ae1509 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,7 @@ jobs: - name: Check out code uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: only-new-issues: ${{ github.event_name == 'pull_request' }} From 5a1e691425c0f7e3d983820093a4f522b3fb3d26 Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Thu, 11 Jan 2024 13:11:58 +0100 Subject: [PATCH 4/5] rename unused vars --- extension/amqp/amqp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/amqp/amqp_test.go b/extension/amqp/amqp_test.go index 9600e935..3a425a49 100644 --- a/extension/amqp/amqp_test.go +++ b/extension/amqp/amqp_test.go @@ -58,7 +58,7 @@ func (ch mockChannel) Consume( ) (<-chan amqp.Delivery, error) { return make(chan amqp.Delivery), nil } -func (ch mockChannel) Qos(_, _ int, global bool) error { +func (ch mockChannel) Qos(_, _ int, _ bool) error { return nil } From f75b647c5a8f7d22399bd4a63bcf92ffcb05ae33 Mon Sep 17 00:00:00 2001 From: svetlanaradyuk Date: Tue, 16 Jan 2024 11:56:28 +0100 Subject: [PATCH 5/5] remove _ when all args are unused --- extension/amqp/amqp_test.go | 2 +- logger_nop.go | 10 +++++----- metadata/matcher.go | 2 +- metadata/metadata.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extension/amqp/amqp_test.go b/extension/amqp/amqp_test.go index 3a425a49..514ded06 100644 --- a/extension/amqp/amqp_test.go +++ b/extension/amqp/amqp_test.go @@ -58,7 +58,7 @@ func (ch mockChannel) Consume( ) (<-chan amqp.Delivery, error) { return make(chan amqp.Delivery), nil } -func (ch mockChannel) Qos(_, _ int, _ bool) error { +func (ch mockChannel) Qos(int, int, bool) error { return nil } diff --git a/logger_nop.go b/logger_nop.go index 80cf8b99..d744f948 100644 --- a/logger_nop.go +++ b/logger_nop.go @@ -8,18 +8,18 @@ var NopLogger Logger = &nopLogger{} type nopLogger struct { } -func (nopLogger) Error(_ string, _ func(LoggerEntry)) { +func (nopLogger) Error(string, func(LoggerEntry)) { } -func (nopLogger) Warn(_ string, _ func(LoggerEntry)) { +func (nopLogger) Warn(string, func(LoggerEntry)) { } -func (nopLogger) Info(_ string, _ func(LoggerEntry)) { +func (nopLogger) Info(string, func(LoggerEntry)) { } -func (nopLogger) Debug(_ string, _ func(LoggerEntry)) { +func (nopLogger) Debug(string, func(LoggerEntry)) { } -func (n *nopLogger) WithFields(_ func(LoggerEntry)) Logger { +func (n *nopLogger) WithFields(func(LoggerEntry)) Logger { return n } diff --git a/metadata/matcher.go b/metadata/matcher.go index 0082ae38..0ec414ee 100644 --- a/metadata/matcher.go +++ b/metadata/matcher.go @@ -65,7 +65,7 @@ func WithConstraint(parent Matcher, field string, operator Operator, value inter } } -func (*emptyMatcher) Iterate(_ func(constraint Constraint)) { +func (*emptyMatcher) Iterate(func(constraint Constraint)) { } func (c *constraintMatcher) Iterate(callback func(constraint Constraint)) { diff --git a/metadata/metadata.go b/metadata/metadata.go index 05b856a3..cf23b555 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -63,7 +63,7 @@ var ( _ easyjson.Marshaler = new(emptyData) ) -func (*emptyData) Value(_ string) interface{} { +func (*emptyData) Value(string) interface{} { return nil }