From 4cbbe69a3ba8cfd5e1f2d04cd77fcc327d1e211b Mon Sep 17 00:00:00 2001 From: Michael Gasch <15986659+embano1@users.noreply.github.com> Date: Sun, 20 Oct 2024 09:25:01 +0200 Subject: [PATCH] fix: golangci-lint errors Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com> --- v2/client/receiver_test.go | 10 ++++++++++ v2/event/eventcontext_v03.go | 2 +- v2/event/eventcontext_v1.go | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/v2/client/receiver_test.go b/v2/client/receiver_test.go index f373ba5e2..a24195e07 100644 --- a/v2/client/receiver_test.go +++ b/v2/client/receiver_test.go @@ -87,6 +87,8 @@ func TestReceiverFnInvalidTypes(t *testing.T) { func TestReceiverFnInvoke_1(t *testing.T) { key := struct{}{} + + //nolint:staticcheck wantCtx := context.WithValue(context.TODO(), key, "UNIT TEST") wantEvent := event.Event{ Context: &event.EventContextV1{ID: "UNIT TEST"}, @@ -124,6 +126,8 @@ func TestReceiverFnInvoke_1(t *testing.T) { func TestReceiverFnInvoke_2(t *testing.T) { key := struct{}{} + + //nolint:staticcheck ctx := context.WithValue(context.TODO(), key, "UNIT TEST") wantEvent := event.Event{ Context: &event.EventContextV1{ @@ -158,6 +162,8 @@ func TestReceiverFnInvoke_2(t *testing.T) { func TestReceiverFnInvoke_3(t *testing.T) { key := struct{}{} + + //nolint:staticcheck ctx := context.WithValue(context.TODO(), key, "UNIT TEST") wantEvent := event.Event{ Context: &event.EventContextV1{ @@ -192,6 +198,8 @@ func TestReceiverFnInvoke_3(t *testing.T) { func TestReceiverFnInvoke_4(t *testing.T) { key := struct{}{} + + //nolint:staticcheck ctx := context.WithValue(context.TODO(), key, "UNIT TEST") wantResp := &event.Event{ Context: &event.EventContextV1{ID: "UNIT TEST"}, @@ -218,6 +226,8 @@ func TestReceiverFnInvoke_4(t *testing.T) { func TestReceiverFnInvoke_5(t *testing.T) { key := struct{}{} + + //nolint:staticcheck ctx := context.WithValue(context.TODO(), key, "UNIT TEST") var wantResp *event.Event diff --git a/v2/event/eventcontext_v03.go b/v2/event/eventcontext_v03.go index 3f0505547..fc67521a2 100644 --- a/v2/event/eventcontext_v03.go +++ b/v2/event/eventcontext_v03.go @@ -314,7 +314,7 @@ func (ec EventContextV03) String() string { b.WriteString(" datacontentencoding: " + *ec.DataContentEncoding + "\n") } - if ec.Extensions != nil && len(ec.Extensions) > 0 { + if len(ec.Extensions) > 0 { b.WriteString("Extensions,\n") keys := make([]string, 0, len(ec.Extensions)) for k := range ec.Extensions { diff --git a/v2/event/eventcontext_v1.go b/v2/event/eventcontext_v1.go index 8f164502b..df311657f 100644 --- a/v2/event/eventcontext_v1.go +++ b/v2/event/eventcontext_v1.go @@ -299,7 +299,7 @@ func (ec EventContextV1) String() string { b.WriteString(" datacontenttype: " + *ec.DataContentType + "\n") } - if ec.Extensions != nil && len(ec.Extensions) > 0 { + if len(ec.Extensions) > 0 { b.WriteString("Extensions,\n") keys := make([]string, 0, len(ec.Extensions)) for k := range ec.Extensions {