Skip to content

Commit

Permalink
Fix govet errors
Browse files Browse the repository at this point in the history
Do not copy NodeGetInfoResponse, it contains many private fields, incl. a
mutex that should not be copied. Use a pointer instead.
  • Loading branch information
jsafrane committed Aug 21, 2024
1 parent d9efbd1 commit 398f2c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,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
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5541,7 +5541,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{
Expand Down

0 comments on commit 398f2c2

Please sign in to comment.