From 6db7138ca0f52a4a53e3eda3675d9fde3ae48914 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 29 Apr 2024 10:35:48 +0200 Subject: [PATCH] build: address gosec warning "Implicit memory aliasing in for loop" gosec warns about it like this: G601: Implicit memory aliasing in for loop. (gosec) Signed-off-by: Niels de Vos --- internal/csi-addons/rbd/replication_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/csi-addons/rbd/replication_test.go b/internal/csi-addons/rbd/replication_test.go index e4c4e3d50..8f12a13aa 100644 --- a/internal/csi-addons/rbd/replication_test.go +++ b/internal/csi-addons/rbd/replication_test.go @@ -261,12 +261,12 @@ func TestCheckRemoteSiteStatus(t *testing.T) { t.Parallel() tests := []struct { name string - args librbd.GlobalMirrorImageStatus + args *librbd.GlobalMirrorImageStatus wantReady bool }{ { name: "Test a single peer in sync", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote", @@ -279,7 +279,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test a single peer in sync, including a local instance", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote", @@ -297,7 +297,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test a multiple peers in sync", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote1", @@ -315,14 +315,14 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test no remote peers", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{}, }, wantReady: false, }, { name: "Test single peer not in sync", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote", @@ -335,7 +335,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test single peer not up", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote", @@ -348,7 +348,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test multiple peers, when first peer is not in sync", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote1", @@ -366,7 +366,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { }, { name: "Test multiple peers, when second peer is not up", - args: librbd.GlobalMirrorImageStatus{ + args: &librbd.GlobalMirrorImageStatus{ SiteStatuses: []librbd.SiteMirrorImageStatus{ { MirrorUUID: "remote1", @@ -386,7 +386,7 @@ func TestCheckRemoteSiteStatus(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { t.Parallel() - if ready := checkRemoteSiteStatus(context.TODO(), &tt.args); ready != tt.wantReady { + if ready := checkRemoteSiteStatus(context.TODO(), tt.args); ready != tt.wantReady { t.Errorf("checkRemoteSiteStatus() ready = %v, expect ready = %v", ready, tt.wantReady) } })