diff --git a/.golangci.yaml b/.golangci.yaml index 465a9ded..8b5fb6a6 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -21,7 +21,6 @@ linters: ### disabled for now... will be enabled 1 by 1 - dupl - forcetypeassert - - goconst - gosec - inamedparam - ireturn diff --git a/api/eventing/v1alpha1/fixtures_test.go b/api/eventing/v1alpha1/fixtures_test.go index 0ddd7ddb..07fdc3b4 100644 --- a/api/eventing/v1alpha1/fixtures_test.go +++ b/api/eventing/v1alpha1/fixtures_test.go @@ -13,11 +13,11 @@ import ( const ( eventSource = "source" - orderCreatedEventType = "prefix." + "noapp." + "order.created.v1" - orderUpdatedEventType = "prefix." + "app." + "order.updated.v1" - orderDeletedEventType = "prefix." + "noapp." + "order.deleted.v1" - orderDeletedEventTypeNonClean = "prefix." + "noapp." + "order.deleted_&.v1" - orderProcessedEventType = "prefix." + "noapp." + "order.processed.v1" + orderCreatedEventType = "prefix.noapp.order.created.v1" + orderUpdatedEventType = "prefix.app.order.updated.v1" + orderDeletedEventType = "prefix.noapp.order.deleted.v1" + orderDeletedEventTypeNonClean = "prefix.noapp.order.deleted_&.v1" + orderProcessedEventType = "prefix.noapp.order.processed.v1" ) const ( diff --git a/api/eventing/v1alpha1/subscription_conversion_unit_test.go b/api/eventing/v1alpha1/subscription_conversion_unit_test.go index 79d0a31f..5c52d859 100644 --- a/api/eventing/v1alpha1/subscription_conversion_unit_test.go +++ b/api/eventing/v1alpha1/subscription_conversion_unit_test.go @@ -236,6 +236,7 @@ func Test_Conversion(t *testing.T) { // Test_CleanupInV1ToV2Conversion test the cleaning from non-alphanumeric characters // and also merging of segments in event types if they exceed the limit. +// nolint:goconst // the event types used here in tests do not get more readable by extracting them to constants func Test_CleanupInV1ToV2Conversion(t *testing.T) { type TestCase struct { name string diff --git a/internal/controller/eventing/subscription/eventmesh/reconciler.go b/internal/controller/eventing/subscription/eventmesh/reconciler.go index 2ad1d7cd..e6c29407 100644 --- a/internal/controller/eventing/subscription/eventmesh/reconciler.go +++ b/internal/controller/eventing/subscription/eventmesh/reconciler.go @@ -136,7 +136,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req kctrl.Request) (kctrl.Re // sync Finalizers, ensure the finalizer is set if err := r.syncFinalizer(sub, log); err != nil { if updateErr := r.updateSubscription(ctx, sub, log); updateErr != nil { - return kctrl.Result{}, xerrors.Errorf(updateErr.Error()+": %v", err) + return kctrl.Result{}, fmt.Errorf("%w: %w", updateErr, err) } return kctrl.Result{}, xerrors.Errorf("failed to sync finalizer: %v", err) } @@ -147,7 +147,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req kctrl.Request) (kctrl.Re sub.Status.SetConditionAPIRuleStatus(err) if !controllererrors.IsSkippable(err) { if updateErr := r.updateSubscription(ctx, sub, log); updateErr != nil { - return kctrl.Result{}, xerrors.Errorf(updateErr.Error()+": %v", err) + return kctrl.Result{}, fmt.Errorf("%w: %w", updateErr, err) } return kctrl.Result{}, err } @@ -156,7 +156,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req kctrl.Request) (kctrl.Re ready, err := r.syncEventMeshSubscription(sub, apiRule, log) if err != nil { if updateErr := r.updateSubscription(ctx, sub, log); updateErr != nil { - return kctrl.Result{}, xerrors.Errorf(updateErr.Error()+": %v", err) + return kctrl.Result{}, fmt.Errorf("%w: %w", updateErr, err) } return kctrl.Result{}, err }