From 83529110e92a51041c8689d02fcfe5cf4bc485ba Mon Sep 17 00:00:00 2001 From: niqi Date: Sun, 23 Aug 2020 18:03:53 +0800 Subject: [PATCH] Fix the bug that nicName in the if block shadows the counterpart outside. --- cluster-autoscaler/cloudprovider/azure/azure_util.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cluster-autoscaler/cloudprovider/azure/azure_util.go b/cluster-autoscaler/cloudprovider/azure/azure_util.go index 8ff90451bdac..95b2276567a6 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_util.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_util.go @@ -144,11 +144,12 @@ func (util *AzUtil) DeleteVirtualMachine(rg string, name string) error { osDiskName := vm.VirtualMachineProperties.StorageProfile.OsDisk.Name var nicName string + var err error nicID := (*vm.VirtualMachineProperties.NetworkProfile.NetworkInterfaces)[0].ID if nicID == nil { klog.Warningf("NIC ID is not set for VM (%s/%s)", rg, name) } else { - nicName, err := resourceName(*nicID) + nicName, err = resourceName(*nicID) if err != nil { return err }