Skip to content

Commit 156ded1

Browse files
committed
refactor(controller): use new() for bool-literal owner-reference flags
Go 1.26's extended new() builtin takes an expression, so new(true) and new(false) replace ptr.To for the owner reference's Controller and BlockOwnerDeletion flags. ptr.Deref, which has no builtin equivalent, stays. Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 8f2395e commit 156ded1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎internal/controller/cacert/reconciler.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,10 +1196,10 @@ func sentinelOwnerRef(tp *internalv1alpha1.TenantProjection) metav1.OwnerReferen
11961196
Name: tp.Name,
11971197
UID: tp.UID,
11981198
// The projection has exactly one manager, this controller.
1199-
Controller: ptr.To(true),
1199+
Controller: new(true),
12001200
// BlockOwnerDeletion stays false: the trust anchor must never hold up the
12011201
// teardown of the application it belongs to.
1202-
BlockOwnerDeletion: ptr.To(false),
1202+
BlockOwnerDeletion: new(false),
12031203
}
12041204
}
12051205

‎internal/controller/cacert/reconciler_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ func TestReconcile_BlockOwnerDeletionDriftIsNormalized(t *testing.T) {
820820
mustReconcile(t, c)
821821

822822
proj := mustProjection(t, c)
823-
proj.OwnerReferences[0].BlockOwnerDeletion = ptr.To(true)
823+
proj.OwnerReferences[0].BlockOwnerDeletion = new(true)
824824
if err := c.Update(context.TODO(), proj); err != nil {
825825
t.Fatalf("set BlockOwnerDeletion drift: %v", err)
826826
}
@@ -846,7 +846,7 @@ func TestReconcile_RecreatedRelease_RehomesProjection(t *testing.T) {
846846
Kind: "TenantProjection",
847847
Name: testSentinel,
848848
UID: types.UID("dead0000-0000-0000-0000-000000000000"), // previous incarnation
849-
Controller: ptr.To(true),
849+
Controller: new(true),
850850
}},
851851
},
852852
Type: corev1.SecretTypeOpaque,

0 commit comments

Comments
 (0)