Skip to content

Commit

Permalink
Correctly use transformed object
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jan 8, 2025
1 parent 094da47 commit 38fba91
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ func CreateOrPatchE(ctx context.Context, c client.Client, obj client.Object, tra

func CreateOrPatch(ctx context.Context, c client.Client, obj client.Object, transform TransformFunc, opts ...client.PatchOption) (kutil.VerbType, error) {
return CreateOrPatchE(ctx, c, obj, func(obj client.Object, createOp bool) (client.Object, error) {
transform(obj, createOp)
return obj, nil
return transform(obj, createOp), nil
}, opts...)
}

Expand Down Expand Up @@ -188,8 +187,7 @@ func PatchE(ctx context.Context, c client.Client, obj client.Object, transform P

func Patch(ctx context.Context, c client.Client, obj client.Object, transform PatchFunc, opts ...client.PatchOption) (kutil.VerbType, error) {
return PatchE(ctx, c, obj, func(obj client.Object) (client.Object, error) {
transform(obj)
return obj, nil
return transform(obj), nil
}, opts...)
}

Expand Down Expand Up @@ -232,8 +230,7 @@ func PatchStatusE(ctx context.Context, c client.Client, obj client.Object, trans

func PatchStatus(ctx context.Context, c client.Client, obj client.Object, transform PatchFunc, opts ...client.SubResourcePatchOption) (kutil.VerbType, error) {
return PatchStatusE(ctx, c, obj, func(obj client.Object) (client.Object, error) {
transform(obj)
return obj, nil
return transform(obj), nil
}, opts...)
}

Expand Down

0 comments on commit 38fba91

Please sign in to comment.