Skip to content

Commit

Permalink
chore: Make checks more idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
Baarsgaard committed Jan 1, 2025
1 parent 157eb83 commit 1915843
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions controllers/controller_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ func GetScopedMatchingInstances(log logr.Logger, ctx context.Context, k8sClient

var list v1beta1.GrafanaList
err := k8sClient.List(ctx, &list, opts...)
if err != nil || len(list.Items) == 0 {
if err != nil {
return []v1beta1.Grafana{}, err
}
if len(list.Items) == 0 {
return []v1beta1.Grafana{}, nil
}

selectedList := []v1beta1.Grafana{}
var unready_instances []string
Expand Down Expand Up @@ -124,9 +127,12 @@ func GetAllMatchingInstances(ctx context.Context, k8sClient client.Client, cr v1

var list v1beta1.GrafanaList
err := k8sClient.List(ctx, &list, client.MatchingLabels(instanceSelector.MatchLabels))
if err != nil || len(list.Items) == 0 {
if err != nil {
return []v1beta1.Grafana{}, err
}
if len(list.Items) == 0 {
return []v1beta1.Grafana{}, nil
}

selectedList := []v1beta1.Grafana{}
for _, instance := range list.Items {
Expand Down

0 comments on commit 1915843

Please sign in to comment.