From d794397467a79d89ff18cab147f98dec3e433b30 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 21 Aug 2024 14:23:35 +0200 Subject: [PATCH] Fix govet errors Do not copy NodeGetInfoResponse, it contains many private fields, incl. a mutex that should not be copied. Use a pointer instead. --- cmd/csi-provisioner/csi-provisioner.go | 2 +- pkg/controller/controller.go | 4 ++-- pkg/controller/controller_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/csi-provisioner/csi-provisioner.go b/cmd/csi-provisioner/csi-provisioner.go index 63480edbf..19f102eef 100644 --- a/cmd/csi-provisioner/csi-provisioner.go +++ b/cmd/csi-provisioner/csi-provisioner.go @@ -318,7 +318,7 @@ func main() { if err != nil { klog.Fatalf("Failed to get node info from CSI driver: %v", err) } - nodeDeployment.NodeInfo = *nodeInfo + nodeDeployment.NodeInfo = nodeInfo } var nodeLister listersv1.NodeLister diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index a9d84464a..be5ccaf44 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -233,7 +233,7 @@ type NodeDeployment struct { ClaimInformer coreinformers.PersistentVolumeClaimInformer // NodeInfo is the result of NodeGetInfo. It is need to determine which // PVs were created for the node. - NodeInfo csi.NodeGetInfoResponse + NodeInfo *csi.NodeGetInfoResponse // ImmediateBinding enables support for PVCs with immediate binding. ImmediateBinding bool // BaseDelay is the initial time that the external-provisioner waits @@ -850,7 +850,7 @@ func (p *csiProvisioner) Provision(ctx context.Context, options controller.Provi } if rep.Volume != nil { - klog.V(3).Infof("create volume rep: %+v", *rep.Volume) + klog.V(3).Infof("create volume rep: %+v", rep.Volume) } volumeAttributes := map[string]string{provisionerIDKey: p.identity} for k, v := range rep.Volume.VolumeContext { diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index 5ffd8af92..748f46bb6 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -5540,7 +5540,7 @@ func runDeleteTest(t *testing.T, k string, tc deleteTestcase) { nodeDeployment = &NodeDeployment{ NodeName: tc.deploymentNode, ClaimInformer: claimInformer, - NodeInfo: csi.NodeGetInfoResponse{ + NodeInfo: &csi.NodeGetInfoResponse{ NodeId: tc.deploymentNode, AccessibleTopology: &csi.Topology{ Segments: map[string]string{