Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 lint: fix import aliases via importas linter #2231

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,56 +85,56 @@ linters-settings:
# - wrapperFunc
# - rangeValCopy
# - hugeParam
# importas:
# no-unaliased: true
# alias:
# # Kubernetes
# - pkg: k8s.io/api/core/v1
# alias: corev1
# - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
# alias: apiextensionsv1
# - pkg: k8s.io/apimachinery/pkg/apis/meta/v1
# alias: metav1
# - pkg: k8s.io/apimachinery/pkg/api/errors
# alias: apierrors
# - pkg: k8s.io/apimachinery/pkg/util/errors
# alias: kerrors
# - pkg: k8s.io/component-base/logs/api/v1
# alias: logsv1
# # Controller Runtime
# - pkg: sigs.k8s.io/controller-runtime
# alias: ctrl
# # CAPV
# - pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1
# alias: infrav1
# - pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1alpha3
# alias: infrav1alpha3
# - pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1alpha4
# alias: infrav1alpha4
# - pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1
# alias: vmwarev1
# # VMware Operator
# - pkg: "github.com/vmware-tanzu/vm-operator/api/v1alpha1"
# alias: vmoprv1
# # CABPK
# - pkg: sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1
# alias: bootstrapv1
# # KCP
# - pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
# alias: controlplanev1
# # CAPI
# - pkg: sigs.k8s.io/cluster-api/api/v1alpha3
# alias: clusterv1alpha3
# - pkg: sigs.k8s.io/cluster-api/api/v1alpha4
# alias: clusterv1alpha4
# - pkg: sigs.k8s.io/cluster-api/api/v1beta1
# alias: clusterv1
# # CAPI exp
# - pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
# alias: expv1
# # CAPI exp addons
# - pkg: sigs.k8s.io/cluster-api/exp/addons/api/v1beta1
# alias: addonsv1
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
- pkg: k8s.io/apimachinery/pkg/util/errors
alias: kerrors
- pkg: k8s.io/component-base/logs/api/v1
alias: logsv1
# Controller Runtime
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
# CAPV
- pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1
alias: infrav1
- pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1alpha3
alias: infrav1alpha3
- pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/v1alpha4
alias: infrav1alpha4
- pkg: sigs.k8s.io/cluster-api-provider-vsphere/apis/vmware/v1beta1
alias: vmwarev1
# VMware Operator
- pkg: "github.com/vmware-tanzu/vm-operator/api/v1alpha1"
alias: vmoprv1
# CABPK
- pkg: sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1
alias: bootstrapv1
# KCP
- pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
alias: controlplanev1
# CAPI
- pkg: sigs.k8s.io/cluster-api/api/v1alpha3
alias: clusterv1alpha3
- pkg: sigs.k8s.io/cluster-api/api/v1alpha4
alias: clusterv1alpha4
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
alias: clusterv1
# CAPI exp
- pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
alias: expv1
# CAPI exp addons
- pkg: sigs.k8s.io/cluster-api/exp/addons/api/v1beta1
alias: addonsv1
nolintlint:
allow-unused: false
allow-leading-space: false
Expand Down
14 changes: 7 additions & 7 deletions apis/v1alpha3/vspherecluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ import (
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo converts this VSphereCluster to the Hub version (v1beta1).
func (src *VSphereCluster) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereCluster)
dst := dstRaw.(*infrav1.VSphereCluster)
if err := Convert_v1alpha3_VSphereCluster_To_v1beta1_VSphereCluster(src, dst, nil); err != nil {
return err
}

// Manually restore data.
restored := &infrav1beta1.VSphereCluster{}
restored := &infrav1.VSphereCluster{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
return err
}
Expand All @@ -45,7 +45,7 @@ func (src *VSphereCluster) ConvertTo(dstRaw conversion.Hub) error {

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereCluster.
func (dst *VSphereCluster) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereCluster)
src := srcRaw.(*infrav1.VSphereCluster)
if err := Convert_v1beta1_VSphereCluster_To_v1alpha3_VSphereCluster(src, dst, nil); err != nil {
return err
}
Expand All @@ -59,16 +59,16 @@ func (dst *VSphereCluster) ConvertFrom(srcRaw conversion.Hub) error {

// ConvertTo converts this VSphereClusterList to the Hub version (v1beta1).
func (src *VSphereClusterList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereClusterList)
dst := dstRaw.(*infrav1.VSphereClusterList)
return Convert_v1alpha3_VSphereClusterList_To_v1beta1_VSphereClusterList(src, dst, nil)
}

// ConvertFrom converts this VSphereVM to the Hub version (v1beta1).
func (dst *VSphereClusterList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereClusterList)
src := srcRaw.(*infrav1.VSphereClusterList)
return Convert_v1beta1_VSphereClusterList_To_v1alpha3_VSphereClusterList(src, dst, nil)
}

func Convert_v1alpha3_VSphereClusterSpec_To_v1beta1_VSphereClusterSpec(in *VSphereClusterSpec, out *infrav1beta1.VSphereClusterSpec, s apiconversion.Scope) error {
func Convert_v1alpha3_VSphereClusterSpec_To_v1beta1_VSphereClusterSpec(in *VSphereClusterSpec, out *infrav1.VSphereClusterSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha3_VSphereClusterSpec_To_v1beta1_VSphereClusterSpec(in, out, s)
}
10 changes: 5 additions & 5 deletions apis/v1alpha3/vsphereclusteridentity_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package v1alpha3
import (
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo converts this VSphereClusterIdentity to the Hub version (v1beta1).
func (src *VSphereClusterIdentity) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereClusterIdentity)
dst := dstRaw.(*infrav1.VSphereClusterIdentity)
if err := Convert_v1alpha3_VSphereClusterIdentity_To_v1beta1_VSphereClusterIdentity(src, dst, nil); err != nil {
return err
}
Expand All @@ -33,7 +33,7 @@ func (src *VSphereClusterIdentity) ConvertTo(dstRaw conversion.Hub) error {

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereClusterIdentity.
func (dst *VSphereClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereClusterIdentity)
src := srcRaw.(*infrav1.VSphereClusterIdentity)
if err := Convert_v1beta1_VSphereClusterIdentity_To_v1alpha3_VSphereClusterIdentity(src, dst, nil); err != nil {
return err
}
Expand All @@ -42,12 +42,12 @@ func (dst *VSphereClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { //

// ConvertTo converts this VSphereClusterIdentityList to the Hub version (v1beta1).
func (src *VSphereClusterIdentityList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereClusterIdentityList)
dst := dstRaw.(*infrav1.VSphereClusterIdentityList)
return Convert_v1alpha3_VSphereClusterIdentityList_To_v1beta1_VSphereClusterIdentityList(src, dst, nil)
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereClusterIdentityList.
func (dst *VSphereClusterIdentityList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereClusterIdentityList)
src := srcRaw.(*infrav1.VSphereClusterIdentityList)
return Convert_v1beta1_VSphereClusterIdentityList_To_v1alpha3_VSphereClusterIdentityList(src, dst, nil)
}
10 changes: 5 additions & 5 deletions apis/v1alpha3/vspheredeploymentzone_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ package v1alpha3
import (
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo converts this VSphereDeploymentZone to the Hub version (v1beta1).
func (src *VSphereDeploymentZone) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereDeploymentZone)
dst := dstRaw.(*infrav1.VSphereDeploymentZone)
return Convert_v1alpha3_VSphereDeploymentZone_To_v1beta1_VSphereDeploymentZone(src, dst, nil)
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereDeploymentZone.
func (dst *VSphereDeploymentZone) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereDeploymentZone)
src := srcRaw.(*infrav1.VSphereDeploymentZone)
return Convert_v1beta1_VSphereDeploymentZone_To_v1alpha3_VSphereDeploymentZone(src, dst, nil)
}

// ConvertTo converts this VSphereDeploymentZoneList to the Hub version (v1beta1).
func (src *VSphereDeploymentZoneList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereDeploymentZoneList)
dst := dstRaw.(*infrav1.VSphereDeploymentZoneList)
return Convert_v1alpha3_VSphereDeploymentZoneList_To_v1beta1_VSphereDeploymentZoneList(src, dst, nil)
}

// ConvertFrom converts this VSphereDeploymentZoneList to the Hub version (v1beta1).
func (dst *VSphereDeploymentZoneList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereDeploymentZoneList)
src := srcRaw.(*infrav1.VSphereDeploymentZoneList)
return Convert_v1beta1_VSphereDeploymentZoneList_To_v1alpha3_VSphereDeploymentZoneList(src, dst, nil)
}
10 changes: 5 additions & 5 deletions apis/v1alpha3/vspherefailuredomain_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ package v1alpha3
import (
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo converts this VSphereFailureDomain to the Hub version (v1beta1).
func (src *VSphereFailureDomain) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereFailureDomain)
dst := dstRaw.(*infrav1.VSphereFailureDomain)
return Convert_v1alpha3_VSphereFailureDomain_To_v1beta1_VSphereFailureDomain(src, dst, nil)
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereFailureDomain.
func (dst *VSphereFailureDomain) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereFailureDomain)
src := srcRaw.(*infrav1.VSphereFailureDomain)
return Convert_v1beta1_VSphereFailureDomain_To_v1alpha3_VSphereFailureDomain(src, dst, nil)
}

// ConvertTo converts this VSphereFailureDomainList to the Hub version (v1beta1).
func (src *VSphereFailureDomainList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereFailureDomainList)
dst := dstRaw.(*infrav1.VSphereFailureDomainList)
return Convert_v1alpha3_VSphereFailureDomainList_To_v1beta1_VSphereFailureDomainList(src, dst, nil)
}

// ConvertFrom converts this VSphereFailureDomainList to the Hub version (v1beta1).
func (dst *VSphereFailureDomainList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
src := srcRaw.(*infrav1beta1.VSphereFailureDomainList)
src := srcRaw.(*infrav1.VSphereFailureDomainList)
return Convert_v1beta1_VSphereFailureDomainList_To_v1alpha3_VSphereFailureDomainList(src, dst, nil)
}
12 changes: 6 additions & 6 deletions apis/v1alpha3/vspheremachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ import (
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo converts this VSphereMachine to the Hub version (v1beta1).
func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereMachine)
dst := dstRaw.(*infrav1.VSphereMachine)
if err := Convert_v1alpha3_VSphereMachine_To_v1beta1_VSphereMachine(src, dst, nil); err != nil {
return err
}

// Manually restore data.
restored := &infrav1beta1.VSphereMachine{}
restored := &infrav1.VSphereMachine{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
return err
}
Expand All @@ -52,7 +52,7 @@ func (src *VSphereMachine) ConvertTo(dstRaw conversion.Hub) error {

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereMachine.
func (dst *VSphereMachine) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereMachine)
src := srcRaw.(*infrav1.VSphereMachine)
if err := Convert_v1beta1_VSphereMachine_To_v1alpha3_VSphereMachine(src, dst, nil); err != nil {
return err
}
Expand All @@ -67,12 +67,12 @@ func (dst *VSphereMachine) ConvertFrom(srcRaw conversion.Hub) error {

// ConvertTo converts this VSphereMachineList to the Hub version (v1beta1).
func (src *VSphereMachineList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereMachineList)
dst := dstRaw.(*infrav1.VSphereMachineList)
return Convert_v1alpha3_VSphereMachineList_To_v1beta1_VSphereMachineList(src, dst, nil)
}

// ConvertFrom converts from the Hub version (v1beta1) to this VSphereMachineList.
func (dst *VSphereMachineList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereMachineList)
src := srcRaw.(*infrav1.VSphereMachineList)
return Convert_v1beta1_VSphereMachineList_To_v1alpha3_VSphereMachineList(src, dst, nil)
}
12 changes: 6 additions & 6 deletions apis/v1alpha3/vspheremachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ import (
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
)

// ConvertTo.
func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereMachineTemplate)
dst := dstRaw.(*infrav1.VSphereMachineTemplate)
if err := Convert_v1alpha3_VSphereMachineTemplate_To_v1beta1_VSphereMachineTemplate(src, dst, nil); err != nil {
return err
}

// Manually restore data.
restored := &infrav1beta1.VSphereMachineTemplate{}
restored := &infrav1.VSphereMachineTemplate{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
return err
}
Expand All @@ -53,7 +53,7 @@ func (src *VSphereMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
}

func (dst *VSphereMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereMachineTemplate)
src := srcRaw.(*infrav1.VSphereMachineTemplate)
if err := Convert_v1beta1_VSphereMachineTemplate_To_v1alpha3_VSphereMachineTemplate(src, dst, nil); err != nil {
return err
}
Expand All @@ -67,12 +67,12 @@ func (dst *VSphereMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
}

func (src *VSphereMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*infrav1beta1.VSphereMachineTemplateList)
dst := dstRaw.(*infrav1.VSphereMachineTemplateList)
return Convert_v1alpha3_VSphereMachineTemplateList_To_v1beta1_VSphereMachineTemplateList(src, dst, nil)
}

func (dst *VSphereMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1beta1.VSphereMachineTemplateList)
src := srcRaw.(*infrav1.VSphereMachineTemplateList)
return Convert_v1beta1_VSphereMachineTemplateList_To_v1alpha3_VSphereMachineTemplateList(src, dst, nil)
}

Expand Down
Loading