Skip to content

Commit

Permalink
chore: enable nakedret linter
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Jun 17, 2024
1 parent e268b8b commit 24c6bbf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ linters:
- unparam
- unused
- wastedassign
- nakedret
linters-settings:
gci:
sections:
Expand Down
4 changes: 2 additions & 2 deletions controller/controlplane/controller_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (r *Reconciler) getControlPlanesFromDataPlane(ctx context.Context, obj clie
"failed to map ControlPlane on DataPlane",
"expected", "DataPlane", "found", reflect.TypeOf(obj),
)
return
return nil
}

controlPlaneList := &operatorv1beta1.ControlPlaneList{}
Expand All @@ -213,7 +213,7 @@ func (r *Reconciler) getControlPlanesFromDataPlane(ctx context.Context, obj clie
index.DataPlaneNameIndex: dataplane.Name,
}); err != nil {
log.FromContext(ctx).Error(err, "failed to map ControlPlane on DataPlane")
return
return nil
}

recs = make([]reconcile.Request, 0, len(controlPlaneList.Items))
Expand Down
12 changes: 6 additions & 6 deletions controller/gateway/controller_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (r *Reconciler) listGatewaysForGatewayClass(ctx context.Context, obj client
return
}

func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj client.Object) (recs []reconcile.Request) {
func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj client.Object) []reconcile.Request {
logger := log.FromContext(ctx)

gatewayConfig, ok := obj.(*operatorv1beta1.GatewayConfiguration)
Expand All @@ -138,7 +138,7 @@ func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj clien
"failed to run map funcs",
"expected", "GatewayConfiguration", "found", reflect.TypeOf(obj),
)
return
return nil
}

gatewayClassList := new(gatewayv1.GatewayClassList)
Expand All @@ -148,7 +148,7 @@ func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj clien
"failed to run map funcs",
"error", err.Error(),
)
return
return nil
}

matchingGatewayClasses := make(map[string]struct{})
Expand All @@ -168,9 +168,10 @@ func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj clien
"failed to run map funcs",
"error", err.Error(),
)
return
return nil
}

var recs []reconcile.Request
for _, gateway := range gatewayList.Items {
if _, ok := matchingGatewayClasses[string(gateway.Spec.GatewayClassName)]; ok {
recs = append(recs, reconcile.Request{
Expand All @@ -181,8 +182,7 @@ func (r *Reconciler) listGatewaysForGatewayConfig(ctx context.Context, obj clien
})
}
}

return
return recs
}

// listReferenceGrantsForGateway is a watch predicate which finds all Gateways mentioned in a From clause for a
Expand Down
5 changes: 2 additions & 3 deletions controller/pkg/secrets/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ func ensureContainerImageUpdated(container *corev1.Container, imageVersionStr st

imageParts := strings.Split(container.Image, ":")
if len(imageParts) > 3 {
err = fmt.Errorf("invalid container image found: %s", container.Image)
return
return false, fmt.Errorf("invalid container image found: %s", container.Image)
}

// This is a special case for registries that specify a non default port,
Expand All @@ -462,5 +461,5 @@ func ensureContainerImageUpdated(container *corev1.Container, imageVersionStr st
updated = true
}

return
return updated, nil
}

0 comments on commit 24c6bbf

Please sign in to comment.