From 97abf3689d023d840aac37d01991c8c12621bffa Mon Sep 17 00:00:00 2001 From: mshobha Date: Wed, 17 Aug 2022 21:30:35 +0530 Subject: [PATCH] Fix lint check for golangci-lint v1.48.0 --- .../clustergroup/cluster_group_resource.go | 20 ++++---------- .../client/workspace/workspace_resource.go | 16 +++-------- internal/helper/request_url.go | 2 +- internal/models/cluster/cluster_type.go | 17 ++++++------ internal/models/cluster/health.go | 17 ++++++------ internal/models/cluster/infra_provider.go | 21 ++++++++------- internal/models/cluster/k8s_provider_type.go | 15 ++++++----- .../models/cluster/nodepool/nodepool_phase.go | 25 ++++++++--------- .../cluster/nodepool/nodepool_severity.go | 15 ++++++----- .../nodepool/nodepools_condition_status.go | 13 ++++----- internal/models/cluster/phase.go | 27 ++++++++++--------- internal/models/namespace/status_phase.go | 19 ++++++------- 12 files changed, 99 insertions(+), 108 deletions(-) diff --git a/internal/client/clustergroup/cluster_group_resource.go b/internal/client/clustergroup/cluster_group_resource.go index 395749711..d8566cb61 100644 --- a/internal/client/clustergroup/cluster_group_resource.go +++ b/internal/client/clustergroup/cluster_group_resource.go @@ -17,9 +17,7 @@ func New(transport *transport.Client) ClientService { return &Client{Client: transport} } -/* - Client for cluster group resource service API -*/ +// Client for cluster group resource service API. type Client struct { *transport.Client } @@ -35,9 +33,7 @@ type ClientService interface { ManageV1alpha1ClusterGroupResourceServiceUpdate(request *clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupRequest) (*clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupResponse, error) } -/* - ManageV1alpha1ClusterGroupResourceServiceGet gets a cluster group -*/ +// ManageV1alpha1ClusterGroupResourceServiceGet gets a cluster group. func (c *Client) ManageV1alpha1ClusterGroupResourceServiceGet( fn *clustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupFullName, ) (*clustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupGetClusterGroupResponse, error) { @@ -49,9 +45,7 @@ func (c *Client) ManageV1alpha1ClusterGroupResourceServiceGet( return clusterGroupResponse, err } -/* - ManageV1alpha1ClusterGroupResourceServiceDelete deletes a cluster group -*/ +// ManageV1alpha1ClusterGroupResourceServiceDelete deletes a cluster group. func (c *Client) ManageV1alpha1ClusterGroupResourceServiceDelete( fn *clustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupFullName, ) error { @@ -60,9 +54,7 @@ func (c *Client) ManageV1alpha1ClusterGroupResourceServiceDelete( return c.Delete(requestURL) } -/* - ManageV1alpha1ClusterGroupResourceServiceCreate creates a cluster group -*/ +// ManageV1alpha1ClusterGroupResourceServiceCreate creates a cluster group. func (c *Client) ManageV1alpha1ClusterGroupResourceServiceCreate( request *clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupRequest, ) (*clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupResponse, error) { @@ -72,9 +64,7 @@ func (c *Client) ManageV1alpha1ClusterGroupResourceServiceCreate( return clusterGroupResponse, err } -/* - ManageV1alpha1ClusterGroupResourceServiceUpdate updates a cluster group -*/ +// ManageV1alpha1ClusterGroupResourceServiceUpdate updates a cluster group. func (c *Client) ManageV1alpha1ClusterGroupResourceServiceUpdate( request *clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupRequest, ) (*clustergroupmodel.VmwareTanzuManageV1alpha1ClusterGroupResponse, error) { diff --git a/internal/client/workspace/workspace_resource.go b/internal/client/workspace/workspace_resource.go index a123fced6..305097914 100644 --- a/internal/client/workspace/workspace_resource.go +++ b/internal/client/workspace/workspace_resource.go @@ -35,9 +35,7 @@ type ClientService interface { ManageV1alpha1WorkspaceResourceServiceUpdate(fn *workspacemodel.VmwareTanzuManageV1alpha1WorkspaceRequest) (*workspacemodel.VmwareTanzuManageV1alphaWorkspaceResponse, error) } -/* - ManageV1alpha1WorkspaceResourceServiceUpdate updates a workspace. -*/ +// ManageV1alpha1WorkspaceResourceServiceUpdate updates a workspace. func (c *Client) ManageV1alpha1WorkspaceResourceServiceUpdate( request *workspacemodel.VmwareTanzuManageV1alpha1WorkspaceRequest, ) (*workspacemodel.VmwareTanzuManageV1alphaWorkspaceResponse, error) { @@ -48,9 +46,7 @@ func (c *Client) ManageV1alpha1WorkspaceResourceServiceUpdate( return namespaceResponse, err } -/* - ManageV1alpha1WorkspaceResourceServiceCreate creates a workspace. -*/ +// ManageV1alpha1WorkspaceResourceServiceCreate creates a workspace. func (c *Client) ManageV1alpha1WorkspaceResourceServiceCreate( request *workspacemodel.VmwareTanzuManageV1alpha1WorkspaceRequest, ) (*workspacemodel.VmwareTanzuManageV1alphaWorkspaceResponse, error) { @@ -60,9 +56,7 @@ func (c *Client) ManageV1alpha1WorkspaceResourceServiceCreate( return namespaceResponse, err } -/* - ManageV1alpha1WorkspaceResourceServiceGet gets a workspace. -*/ +// ManageV1alpha1WorkspaceResourceServiceGet gets a workspace. func (c *Client) ManageV1alpha1WorkspaceResourceServiceGet( fn *workspacemodel.VmwareTanzuManageV1alpha1WorkspaceFullName, ) (*workspacemodel.VmwareTanzuManageV1alpha1WorkspaceGetWorkspaceResponse, error) { @@ -74,9 +68,7 @@ func (c *Client) ManageV1alpha1WorkspaceResourceServiceGet( return workspaceResponse, err } -/* - ManageV1alpha1WorkspaceResourceServiceDelete deletes a workspace. -*/ +// ManageV1alpha1WorkspaceResourceServiceDelete deletes a workspace. func (c *Client) ManageV1alpha1WorkspaceResourceServiceDelete( fn *workspacemodel.VmwareTanzuManageV1alpha1WorkspaceFullName, ) error { diff --git a/internal/helper/request_url.go b/internal/helper/request_url.go index 02496a836..e2f25f52c 100644 --- a/internal/helper/request_url.go +++ b/internal/helper/request_url.go @@ -29,7 +29,7 @@ func ConstructRequestURL(paths ...string) (url RequestURL) { // AppendQueryParams appends query parameters to a request URL. func (ru RequestURL) AppendQueryParams(queryParameters url.Values) (url RequestURL) { - if queryParameters == nil || len(queryParameters) == 0 { + if len(queryParameters) == 0 { return ru } diff --git a/internal/models/cluster/cluster_type.go b/internal/models/cluster/cluster_type.go index 3c20d6002..73f1e4e58 100644 --- a/internal/models/cluster/cluster_type.go +++ b/internal/models/cluster/cluster_type.go @@ -10,14 +10,15 @@ import ( ) // VmwareTanzuManageV1alpha1ClusterType Type describe type of cluster. -// -// - TYPE_UNSPECIFIED: TYPE_UNSPECIFIED cluster type. -// - ATTACHED: ATTACHED cluster type. -// - PROVISIONED: PROVISIONED cluster type. -// - TANZU_KUBERNETES_GRID_SERVICE: Tanzu Kubernetes Grid Service cluster type. -// - TANZU_KUBERNETES_GRID: Tanzu Kubernetes Grid cluster type. -// -// swagger:model vmware.tanzu.manage.v1alpha1.cluster.Type +/* + - TYPE_UNSPECIFIED: TYPE_UNSPECIFIED cluster type. + - ATTACHED: ATTACHED cluster type. + - PROVISIONED: PROVISIONED cluster type. + - TANZU_KUBERNETES_GRID_SERVICE: Tanzu Kubernetes Grid Service cluster type. + - TANZU_KUBERNETES_GRID: Tanzu Kubernetes Grid cluster type. + + swagger:model vmware.tanzu.manage.v1alpha1.cluster.Type +*/ type VmwareTanzuManageV1alpha1ClusterType string func NewVmwareTanzuManageV1alpha1ClusterType(value VmwareTanzuManageV1alpha1ClusterType) *VmwareTanzuManageV1alpha1ClusterType { diff --git a/internal/models/cluster/health.go b/internal/models/cluster/health.go index 37128a0cd..8f9a20bba 100644 --- a/internal/models/cluster/health.go +++ b/internal/models/cluster/health.go @@ -10,14 +10,15 @@ import ( ) // VmwareTanzuManageV1alpha1CommonClusterHealth Health describes the health of a resource. -// -// - HEALTH_UNSPECIFIED: Unspecified health. -// - HEALTHY: Resource is healthy. -// - WARNING: Resource is in warning state. -// - UNHEALTHY: Resource is unhealthy. -// - DISCONNECTED: Resource is disconnected. -// -// swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.Health +/* + - HEALTH_UNSPECIFIED: Unspecified health. + - HEALTHY: Resource is healthy. + - WARNING: Resource is in warning state. + - UNHEALTHY: Resource is unhealthy. + - DISCONNECTED: Resource is disconnected. + + swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.Health +*/ type VmwareTanzuManageV1alpha1CommonClusterHealth string func NewVmwareTanzuManageV1alpha1CommonClusterHealth(value VmwareTanzuManageV1alpha1CommonClusterHealth) *VmwareTanzuManageV1alpha1CommonClusterHealth { diff --git a/internal/models/cluster/infra_provider.go b/internal/models/cluster/infra_provider.go index de3cbdf70..6d4a0fde8 100644 --- a/internal/models/cluster/infra_provider.go +++ b/internal/models/cluster/infra_provider.go @@ -10,16 +10,17 @@ import ( ) // VmwareTanzuManageV1alpha1CommonClusterInfrastructureProvider InfrastructureProvider definition - indicates the cluster infrastructure provider. -// -// - INFRASTRUCTURE_PROVIDER_UNSPECIFIED: Unspecified infrastructure provider (default). -// - INFRASTRUCTURE_PROVIDER_NONE: No cloud provider (likely bare metal). -// - AWS_EC2: AmazonWeb Services EC2. -// - GCP_GCE: Google Cloud. -// - AZURE_COMPUTE: Azure Compute. -// - VMWARE_VSPHERE: VMWare vSphere. -// - OPENSHIFT: OpenShift. -// -// swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.InfrastructureProvider +/* + - INFRASTRUCTURE_PROVIDER_UNSPECIFIED: Unspecified infrastructure provider (default). + - INFRASTRUCTURE_PROVIDER_NONE: No cloud provider (likely bare metal). + - AWS_EC2: AmazonWeb Services EC2. + - GCP_GCE: Google Cloud. + - AZURE_COMPUTE: Azure Compute. + - VMWARE_VSPHERE: VMWare vSphere. + - OPENSHIFT: OpenShift. + + swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.InfrastructureProvider +*/ type VmwareTanzuManageV1alpha1CommonClusterInfrastructureProvider string func NewVmwareTanzuManageV1alpha1CommonClusterInfrastructureProvider(value VmwareTanzuManageV1alpha1CommonClusterInfrastructureProvider) *VmwareTanzuManageV1alpha1CommonClusterInfrastructureProvider { diff --git a/internal/models/cluster/k8s_provider_type.go b/internal/models/cluster/k8s_provider_type.go index 66b977f61..944d65296 100644 --- a/internal/models/cluster/k8s_provider_type.go +++ b/internal/models/cluster/k8s_provider_type.go @@ -10,13 +10,14 @@ import ( ) // VmwareTanzuManageV1alpha1CommonClusterKubernetesProviderType KubernetesProviderType definition - indicates the k8s provider Type. -// -// - KUBERNETES_PROVIDER_UNSPECIFIED: Unspecified k8s provider (default). -// - VMWARE_TANZU_KUBERNETES_GRID: VMware Tanzu Kubernetes Grid. -// - VMWARE_TANZU_KUBERNETES_GRID_SERVICE: VMware Tanzu Kubernetes Grid Service (Guest Cluster Management). -// - VMWARE_TANZU_KUBERNETES_GRID_HOSTED: VMware Tanzu Kubernetes Grid hosted in TMC. -// -// swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.KubernetesProviderType +/* + - KUBERNETES_PROVIDER_UNSPECIFIED: Unspecified k8s provider (default). + - VMWARE_TANZU_KUBERNETES_GRID: VMware Tanzu Kubernetes Grid. + - VMWARE_TANZU_KUBERNETES_GRID_SERVICE: VMware Tanzu Kubernetes Grid Service (Guest Cluster Management). + - VMWARE_TANZU_KUBERNETES_GRID_HOSTED: VMware Tanzu Kubernetes Grid hosted in TMC. + + swagger:model vmware.tanzu.manage.v1alpha1.common.cluster.KubernetesProviderType +*/ type VmwareTanzuManageV1alpha1CommonClusterKubernetesProviderType string func NewVmwareTanzuManageV1alpha1CommonClusterKubernetesProviderType(value VmwareTanzuManageV1alpha1CommonClusterKubernetesProviderType) *VmwareTanzuManageV1alpha1CommonClusterKubernetesProviderType { diff --git a/internal/models/cluster/nodepool/nodepool_phase.go b/internal/models/cluster/nodepool/nodepool_phase.go index a1db8aab7..58f834926 100644 --- a/internal/models/cluster/nodepool/nodepool_phase.go +++ b/internal/models/cluster/nodepool/nodepool_phase.go @@ -8,18 +8,19 @@ package nodepool import "encoding/json" // VmwareTanzuManageV1alpha1ClusterNodepoolStatusPhase Phase of the nodepool resource. -// -// - PHASE_UNSPECIFIED: Unspecified phase. -// - CREATING: Resource is pending processing. -// - READY: Resource is in ready state. -// - ERROR: Error in processing. -// - DELETING: Resource is being deleted. -// - RESIZING: Resizing state. -// - UPGRADING: An upgrade is in progress. -// - UPGRADE_FAILED: An upgrade has failed. -// - WAITING: The cluster is not created yet. so wait till then. -// -// swagger:model vmware.tanzu.manage.v1alpha1.cluster.nodepool.Status.Phase +/* + - PHASE_UNSPECIFIED: Unspecified phase. + - CREATING: Resource is pending processing. + - READY: Resource is in ready state. + - ERROR: Error in processing. + - DELETING: Resource is being deleted. + - RESIZING: Resizing state. + - UPGRADING: An upgrade is in progress. + - UPGRADE_FAILED: An upgrade has failed. + - WAITING: The cluster is not created yet. so wait till then. + + swagger:model vmware.tanzu.manage.v1alpha1.cluster.nodepool.Status.Phase +*/ type VmwareTanzuManageV1alpha1ClusterNodepoolStatusPhase string func NewVmwareTanzuManageV1alpha1ClusterNodepoolStatusPhase(value VmwareTanzuManageV1alpha1ClusterNodepoolStatusPhase) *VmwareTanzuManageV1alpha1ClusterNodepoolStatusPhase { diff --git a/internal/models/cluster/nodepool/nodepool_severity.go b/internal/models/cluster/nodepool/nodepool_severity.go index da240a415..e1a63b30d 100644 --- a/internal/models/cluster/nodepool/nodepool_severity.go +++ b/internal/models/cluster/nodepool/nodepool_severity.go @@ -8,13 +8,14 @@ package nodepool import "encoding/json" // VmwareTanzuCoreV1alpha1StatusConditionSeverity Severity expresses the severity of a Condition Type failing. -// -// - SEVERITY_UNSPECIFIED: Unspecified severity. -// - ERROR: Failure of a condition type should be viewed as an error. -// - WARNING: Failure of a condition type should be viewed as a warning, but that things could still work. -// - INFO: Failure of a condition type should be viewed as purely informational, and that things could still work. -// -// swagger:model vmware.tanzu.core.v1alpha1.status.Condition.Severity +/* + - SEVERITY_UNSPECIFIED: Unspecified severity. + - ERROR: Failure of a condition type should be viewed as an error. + - WARNING: Failure of a condition type should be viewed as a warning, but that things could still work. + - INFO: Failure of a condition type should be viewed as purely informational, and that things could still work. + + swagger:model vmware.tanzu.core.v1alpha1.status.Condition.Severity +*/ type VmwareTanzuCoreV1alpha1StatusConditionSeverity string func NewVmwareTanzuCoreV1alpha1StatusConditionSeverity(value VmwareTanzuCoreV1alpha1StatusConditionSeverity) *VmwareTanzuCoreV1alpha1StatusConditionSeverity { diff --git a/internal/models/cluster/nodepool/nodepools_condition_status.go b/internal/models/cluster/nodepool/nodepools_condition_status.go index 084a8d328..c26da4b12 100644 --- a/internal/models/cluster/nodepool/nodepools_condition_status.go +++ b/internal/models/cluster/nodepool/nodepools_condition_status.go @@ -8,12 +8,13 @@ package nodepool import "encoding/json" // VmwareTanzuCoreV1alpha1StatusConditionStatus Status describes the state of condition. -// -// - STATUS_UNSPECIFIED: Controller is actively working to achieve the condition. -// - TRUE: Reconciliation has succeeded. Once all transition conditions have succeeded, the "happy state" condition should be set to True.. -// - FALSE: Reconciliation has failed. This should be a terminal failure state until user action occurs. -// -// swagger:model vmware.tanzu.core.v1alpha1.status.Condition.Status +/* + - STATUS_UNSPECIFIED: Controller is actively working to achieve the condition. + - TRUE: Reconciliation has succeeded. Once all transition conditions have succeeded, the "happy state" condition should be set to True.. + - FALSE: Reconciliation has failed. This should be a terminal failure state until user action occurs. + + swagger:model vmware.tanzu.core.v1alpha1.status.Condition.Status +*/ type VmwareTanzuCoreV1alpha1StatusConditionStatus string func NewVmwareTanzuCoreV1alpha1StatusConditionStatus(value VmwareTanzuCoreV1alpha1StatusConditionStatus) *VmwareTanzuCoreV1alpha1StatusConditionStatus { diff --git a/internal/models/cluster/phase.go b/internal/models/cluster/phase.go index b672fffd1..3f63fc26b 100644 --- a/internal/models/cluster/phase.go +++ b/internal/models/cluster/phase.go @@ -10,19 +10,20 @@ import ( ) // VmwareTanzuManageV1alpha1ClusterPhase Phase of the cluster resource. -// -// - PHASE_UNSPECIFIED: Unspecified phase. -// - PENDING: Resource is pending processing. -// - PROCESSING: Processing the resource. -// - CREATING: Resource is being created. -// - READY: Resource is ready state. -// - DELETING: Resource is being deleted. -// - ERROR: Error in processing. -// - DETACHING: Resource is being detached. -// - UPGRADING: An upgrade is in progress. -// - UPGRADE_FAILED: An upgrade has failed. -// -// swagger:model vmware.tanzu.manage.v1alpha1.cluster.Phase +/* + - PHASE_UNSPECIFIED: Unspecified phase. + - PENDING: Resource is pending processing. + - PROCESSING: Processing the resource. + - CREATING: Resource is being created. + - READY: Resource is ready state. + - DELETING: Resource is being deleted. + - ERROR: Error in processing. + - DETACHING: Resource is being detached. + - UPGRADING: An upgrade is in progress. + - UPGRADE_FAILED: An upgrade has failed. + + swagger:model vmware.tanzu.manage.v1alpha1.cluster.Phase +*/ type VmwareTanzuManageV1alpha1ClusterPhase string func NewVmwareTanzuManageV1alpha1ClusterPhase(value VmwareTanzuManageV1alpha1ClusterPhase) *VmwareTanzuManageV1alpha1ClusterPhase { diff --git a/internal/models/namespace/status_phase.go b/internal/models/namespace/status_phase.go index c28dcfcd6..d2588e0dc 100644 --- a/internal/models/namespace/status_phase.go +++ b/internal/models/namespace/status_phase.go @@ -10,15 +10,16 @@ import ( ) // VmwareTanzuManageV1alpha1ClusterNamespaceStatusPhase The overall phase of the namespace. -// -// - PHASE_UNSPECIFIED: Phase_unspecified is the default phase -// - CREATING: Creating phase is set when the namespace is being created. -// - ATTACHING: Attaching phase is set when the namespace is being attached. -// - UPDATING: Updating phase is set when the namespace is being updated. -// - READY: Ready phase is set when the namespace is successfully created/attached/updated. -// - ERROR: Error phase is set when there was a failure while creating/attaching/updating the namespace. -// -// swagger:model vmware.tanzu.manage.v1alpha1.cluster.namespace.Status.Phase +/* + - PHASE_UNSPECIFIED: Phase_unspecified is the default phase + - CREATING: Creating phase is set when the namespace is being created. + - ATTACHING: Attaching phase is set when the namespace is being attached. + - UPDATING: Updating phase is set when the namespace is being updated. + - READY: Ready phase is set when the namespace is successfully created/attached/updated. + - ERROR: Error phase is set when there was a failure while creating/attaching/updating the namespace. + + swagger:model vmware.tanzu.manage.v1alpha1.cluster.namespace.Status.Phase +*/ type VmwareTanzuManageV1alpha1ClusterNamespaceStatusPhase string func NewVmwareTanzuManageV1alpha1ClusterNamespaceStatusPhase(value VmwareTanzuManageV1alpha1ClusterNamespaceStatusPhase) *VmwareTanzuManageV1alpha1ClusterNamespaceStatusPhase {