From 9b907fa884b7af9edfc5aabd11412fef00c08d0b Mon Sep 17 00:00:00 2001 From: Pawan Prakash Sharma Date: Fri, 25 Jun 2021 11:44:24 +0530 Subject: [PATCH] fix(crash): reuse the err variable (#353) The error variable is being redeclared, so this is not accessible outside of the loop and the provisioner is crashing while return in case of error as it tries to access err.Error and err is nil outside of the loop. Signed-off-by: Pawan --- pkg/driver/controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/driver/controller.go b/pkg/driver/controller.go index 10a306a..3f8795c 100644 --- a/pkg/driver/controller.go +++ b/pkg/driver/controller.go @@ -290,7 +290,8 @@ func CreateZFSVolume(ctx context.Context, req *csi.CreateVolumeRequest) (string, // try volume creation sequentially on all nodes for _, node := range prfList { - nodeid, err := zfs.GetNodeID(node) + var nodeid string + nodeid, err = zfs.GetNodeID(node) if err != nil { continue }