Skip to content

Commit

Permalink
enable goconst
Browse files Browse the repository at this point in the history
  • Loading branch information
k15r committed Dec 19, 2023
1 parent 2efa05c commit 6ae3528
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linters:
### disabled for now... will be enabled 1 by 1
- dupl
- forcetypeassert
- goconst
- gosec
- inamedparam
- ireturn
Expand Down
10 changes: 5 additions & 5 deletions api/eventing/v1alpha1/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions api/eventing/v1alpha1/subscription_conversion_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 6ae3528

Please sign in to comment.