From 71cfff0795cb66ebecf1bc345ce8e0136e519656 Mon Sep 17 00:00:00 2001 From: Thomas Kappler Date: Fri, 19 Aug 2022 16:11:09 -0700 Subject: [PATCH] [nit] replace if-else cascade by switch #1566 --- provider/pkg/provider/provider.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index 44984d4f656d..c88c5a0b7fa1 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -199,14 +199,14 @@ func (k *azureNativeProvider) Configure(ctx context.Context, // Translate between the autorest and the azure-sdk-for-go representation of Azure clouds. func (k *azureNativeProvider) cloud() cloud.Configuration { - thisCloud := cloud.AzurePublic - if k.environment.Name == azure.USGovernmentCloud.Name { - thisCloud = cloud.AzureGovernment - } else if k.environment.Name == azure.ChinaCloud.Name { - thisCloud = cloud.AzureChina + switch k.environment.Name { + case azure.USGovernmentCloud.Name: + return cloud.AzureGovernment + case azure.ChinaCloud.Name: + return cloud.AzureChina + default: + return cloud.AzurePublic } - - return thisCloud } // Invoke dynamically executes a built-in function in the provider.