From a86ffc8c5777fd7849be6f635b1b61b36bc41e81 Mon Sep 17 00:00:00 2001 From: Tao Yang Date: Mon, 21 Oct 2019 10:19:32 +0800 Subject: [PATCH] Apply suggestions from code review fix formatting based on review Co-Authored-By: Tejal Desai --- pkg/buildcontext/azureblob.go | 6 +++--- pkg/constants/constants.go | 2 +- pkg/util/azureblob_util.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/buildcontext/azureblob.go b/pkg/buildcontext/azureblob.go index f3f1b1ad7..bb58bd4fa 100644 --- a/pkg/buildcontext/azureblob.go +++ b/pkg/buildcontext/azureblob.go @@ -37,18 +37,18 @@ type AzureBlob struct { // Download context file from given azure blob storage url and unpack it to BuildContextDir func (b *AzureBlob) UnpackTarFromBuildContext() (string, error) { - //Get Azure_STORAGE_ACCESS_KEY from environment variables + // Get Azure_STORAGE_ACCESS_KEY from environment variables accountKey := os.Getenv("AZURE_STORAGE_ACCESS_KEY") if len(accountKey) == 0 { return "", errors.New("AZURE_STORAGE_ACCESS_KEY environment variable is not set") } - //Get storage accoutname for Azure Blob Storage + // Get storage accoutname for Azure Blob Storage u, _ := url.Parse(b.context) parts := azblob.NewBlobURLParts(*u) accountName := strings.Split(parts.Host, ".")[0] - //Generate credentail with accountname and accountkey + // Generate credentail with accountname and accountkey credential, err := azblob.NewSharedKeyCredential(accountName, accountKey) if err != nil { return parts.Host, err diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 699b13355..9de493eb2 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -80,7 +80,7 @@ const ( // ScratchEnvVars are the default environment variables needed for a scratch image. var ScratchEnvVars = []string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"} -//AzureBlobStorageHostRegEx is ReqEX for Valid azure blob storage host suffix in url for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment +// AzureBlobStorageHostRegEx is ReqEX for Valid azure blob storage host suffix in url for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment var AzureBlobStorageHostRegEx = []string{"https://(.+?).blob.core.windows.net/(.+)", "https://(.+?).blob.core.chinacloudapi.cn/(.+)", "https://(.+?).blob.core.cloudapi.de/(.+)", diff --git a/pkg/util/azureblob_util.go b/pkg/util/azureblob_util.go index c5e60c866..e856e309a 100644 --- a/pkg/util/azureblob_util.go +++ b/pkg/util/azureblob_util.go @@ -22,8 +22,8 @@ import ( "github.com/GoogleContainerTools/kaniko/pkg/constants" ) -//Validate if the host url provided is with correct suffix for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment -//RegEX for supported suffix defined in constants.AzureBlobStorageHostRegEx +// Validate if the host url provided is with correct suffix for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment +// RegEX for supported suffix defined in constants.AzureBlobStorageHostRegEx func ValidAzureBlobStorageHost(context string) bool { for _, re := range constants.AzureBlobStorageHostRegEx { validBlobURL := regexp.MustCompile(re)