From 7f3b24098e7a584d11f2735404e8a669d5efc780 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Sun, 18 May 2025 11:08:04 +0100 Subject: [PATCH] chore(codebase-uniformity): added linters for json/yaml tags Signed-off-by: ivan katliarchuk --- .golangci.yml | 2 ++ provider/alibabacloud/alibaba_cloud.go | 12 ++++++------ provider/azure/config.go | 18 +++++++++--------- provider/ibmcloud/ibmcloud.go | 8 ++++---- provider/tencentcloud/tencent_cloud.go | 8 ++++---- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 17669081a..1b5f134a2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,6 +14,8 @@ linters: - unconvert - unused - whitespace + - decorder # Check declaration order and count of types, constants, variables and functions. https://golangci-lint.run/usage/linters/#decorder + - tagalign # Check that struct tags are well aligned. https://golangci-lint.run/usage/linters/#tagalign - predeclared # Find code that shadows one of Go's predeclared identifiers - sloglint # Ensure consistent code style when using log/slog - asciicheck # Checks that all code identifiers does not have non-ASCII symbols in the name diff --git a/provider/alibabacloud/alibaba_cloud.go b/provider/alibabacloud/alibaba_cloud.go index 16318385e..9ff690c34 100644 --- a/provider/alibabacloud/alibaba_cloud.go +++ b/provider/alibabacloud/alibaba_cloud.go @@ -85,13 +85,13 @@ type AlibabaCloudProvider struct { } type alibabaCloudConfig struct { - RegionID string `json:"regionId" yaml:"regionId"` - AccessKeyID string `json:"accessKeyId" yaml:"accessKeyId"` + RegionID string `json:"regionId" yaml:"regionId"` + AccessKeyID string `json:"accessKeyId" yaml:"accessKeyId"` AccessKeySecret string `json:"accessKeySecret" yaml:"accessKeySecret"` - VPCID string `json:"vpcId" yaml:"vpcId"` - RoleName string `json:"-" yaml:"-"` // For ECS RAM role only - StsToken string `json:"-" yaml:"-"` - ExpireTime time.Time `json:"-" yaml:"-"` + VPCID string `json:"vpcId" yaml:"vpcId"` + RoleName string `json:"-" yaml:"-"` // For ECS RAM role only + StsToken string `json:"-" yaml:"-"` + ExpireTime time.Time `json:"-" yaml:"-"` } // NewAlibabaCloudProvider creates a new Alibaba Cloud provider. diff --git a/provider/azure/config.go b/provider/azure/config.go index cebe0f27c..e64f3857b 100644 --- a/provider/azure/config.go +++ b/provider/azure/config.go @@ -35,16 +35,16 @@ import ( // config represents common config items for Azure DNS and Azure Private DNS type config struct { - Cloud string `json:"cloud" yaml:"cloud"` - TenantID string `json:"tenantId" yaml:"tenantId"` - SubscriptionID string `json:"subscriptionId" yaml:"subscriptionId"` - ResourceGroup string `json:"resourceGroup" yaml:"resourceGroup"` - Location string `json:"location" yaml:"location"` - ClientID string `json:"aadClientId" yaml:"aadClientId"` - ClientSecret string `json:"aadClientSecret" yaml:"aadClientSecret"` - UseManagedIdentityExtension bool `json:"useManagedIdentityExtension" yaml:"useManagedIdentityExtension"` + Cloud string `json:"cloud" yaml:"cloud"` + TenantID string `json:"tenantId" yaml:"tenantId"` + SubscriptionID string `json:"subscriptionId" yaml:"subscriptionId"` + ResourceGroup string `json:"resourceGroup" yaml:"resourceGroup"` + Location string `json:"location" yaml:"location"` + ClientID string `json:"aadClientId" yaml:"aadClientId"` + ClientSecret string `json:"aadClientSecret" yaml:"aadClientSecret"` + UseManagedIdentityExtension bool `json:"useManagedIdentityExtension" yaml:"useManagedIdentityExtension"` UseWorkloadIdentityExtension bool `json:"useWorkloadIdentityExtension" yaml:"useWorkloadIdentityExtension"` - UserAssignedIdentityID string `json:"userAssignedIdentityID" yaml:"userAssignedIdentityID"` + UserAssignedIdentityID string `json:"userAssignedIdentityID" yaml:"userAssignedIdentityID"` ActiveDirectoryAuthorityHost string `json:"activeDirectoryAuthorityHost" yaml:"activeDirectoryAuthorityHost"` } diff --git a/provider/ibmcloud/ibmcloud.go b/provider/ibmcloud/ibmcloud.go index 85bc8ae72..980789c89 100644 --- a/provider/ibmcloud/ibmcloud.go +++ b/provider/ibmcloud/ibmcloud.go @@ -186,11 +186,11 @@ type IBMCloudProvider struct { } type ibmcloudConfig struct { - Endpoint string `json:"endpoint" yaml:"endpoint"` - APIKey string `json:"apiKey" yaml:"apiKey"` + Endpoint string `json:"endpoint" yaml:"endpoint"` + APIKey string `json:"apiKey" yaml:"apiKey"` CRN string `json:"instanceCrn" yaml:"instanceCrn"` - IAMURL string `json:"iamUrl" yaml:"iamUrl"` - InstanceID string `json:"-" yaml:"-"` + IAMURL string `json:"iamUrl" yaml:"iamUrl"` + InstanceID string `json:"-" yaml:"-"` } // ibmcloudChange differentiates between ChangActions diff --git a/provider/tencentcloud/tencent_cloud.go b/provider/tencentcloud/tencent_cloud.go index e52a4df84..f4435a011 100644 --- a/provider/tencentcloud/tencent_cloud.go +++ b/provider/tencentcloud/tencent_cloud.go @@ -75,10 +75,10 @@ type TencentCloudProvider struct { } type tencentCloudConfig struct { - RegionId string `json:"regionId" yaml:"regionId"` - SecretId string `json:"secretId" yaml:"secretId"` - SecretKey string `json:"secretKey" yaml:"secretKey"` - VPCId string `json:"vpcId" yaml:"vpcId"` + RegionId string `json:"regionId" yaml:"regionId"` + SecretId string `json:"secretId" yaml:"secretId"` + SecretKey string `json:"secretKey" yaml:"secretKey"` + VPCId string `json:"vpcId" yaml:"vpcId"` InternetEndpoint bool `json:"internetEndpoint" yaml:"internetEndpoint"` }