Skip to content

Commit b4ab6d2

Browse files
committed
improvement
1 parent 08e19a2 commit b4ab6d2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/controller/shared_controller.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,20 +1207,19 @@ func createOrUpdateAllForWMSWFS[R Reconciler, O pdoknlv3.WMSWFS](ctx context.Con
12071207
return operationResults, nil
12081208
}
12091209

1210-
func getConfigMap[O pdoknlv3.WMSWFS, R Reconciler](ctx context.Context, obj O, reconciler R, name string, mutate func(R, O, *corev1.ConfigMap) error) (cm *corev1.ConfigMap, operationResult *controllerutil.OperationResult, err error) {
1210+
func getConfigMap[O pdoknlv3.WMSWFS, R Reconciler](ctx context.Context, obj O, reconciler R, name string, mutate func(R, O, *corev1.ConfigMap) error) (*corev1.ConfigMap, *controllerutil.OperationResult, error) {
12111211
reconcilerClient := getReconcilerClient(reconciler)
1212-
cm = getBareConfigMap(obj, name)
1213-
if err = mutate(reconciler, obj, cm); err != nil {
1212+
cm := getBareConfigMap(obj, name)
1213+
if err := mutate(reconciler, obj, cm); err != nil {
12141214
return cm, nil, err
12151215
}
12161216
or, err := controllerutil.CreateOrUpdate(ctx, reconcilerClient, cm, func() error {
12171217
return mutate(reconciler, obj, cm)
12181218
})
1219-
operationResult = &or
12201219
if err != nil {
1221-
return cm, operationResult, fmt.Errorf("unable to create/update resource %s: %w", smoothoperatorutils.GetObjectFullName(reconcilerClient, cm), err)
1220+
return cm, &or, fmt.Errorf("unable to create/update resource %s: %w", smoothoperatorutils.GetObjectFullName(reconcilerClient, cm), err)
12221221
}
1223-
return
1222+
return cm, &or, nil
12241223
}
12251224

12261225
// TODO fix linting (funlen)

0 commit comments

Comments
 (0)