Skip to content

Commit

Permalink
Enhance the gci lint (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkumatag authored Sep 12, 2022
1 parent b278813 commit b25a65d
Show file tree
Hide file tree
Showing 38 changed files with 123 additions and 41 deletions.
11 changes: 10 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ linters-settings:
- '^ \+.*'
- '^ ANCHOR.*'
gci:
local-prefixes: "sigs.k8s.io/cluster-api-provider-ibmcloud"
sections:
- standard
- default
- prefix(github.com/IBM)
- prefix(k8s.io)
- prefix(sigs.k8s.io)
- prefix(sigs.k8s.io/cluster-api)
- prefix(sigs.k8s.io/cluster-api-provider-ibmcloud)
- blank
- dot
importas:
no-unaliased: true
alias:
Expand Down
4 changes: 3 additions & 1 deletion api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package v1alpha3

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"

"sigs.k8s.io/controller-runtime/pkg/conversion"

capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha3/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package v1alpha3

import (
"k8s.io/apimachinery/pkg/runtime/schema"

"sigs.k8s.io/controller-runtime/pkg/scheme"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha3/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha3

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha4

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"

capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package v1alpha4

import (
"k8s.io/apimachinery/pkg/runtime/schema"

"sigs.k8s.io/controller-runtime/pkg/scheme"
)

Expand Down
4 changes: 3 additions & 1 deletion api/v1alpha4/ibmpowervs_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package v1alpha4

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"

"sigs.k8s.io/controller-runtime/pkg/conversion"

utilconversion "sigs.k8s.io/cluster-api/util/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha4

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/ibmvpc_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha4

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"

"sigs.k8s.io/controller-runtime/pkg/conversion"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha4

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime/schema"

"sigs.k8s.io/controller-runtime/pkg/scheme"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervscluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervsimage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervsimage_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/errors"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervsmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmpowervsmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmvpccluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmvpcmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/ibmvpcmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime"

ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down
10 changes: 7 additions & 3 deletions cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ import (
"context"
"fmt"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/vpc-go-sdk/vpcv1"
"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/vpc-go-sdk/vpcv1"

"k8s.io/klog/v2/klogr"

"sigs.k8s.io/controller-runtime/pkg/client"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/controller-runtime/pkg/client"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/vpc"
Expand Down
10 changes: 7 additions & 3 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ package scope
import (
"context"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/vpc-go-sdk/vpcv1"
"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/vpc-go-sdk/vpcv1"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2/klogr"

"sigs.k8s.io/controller-runtime/pkg/client"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/controller-runtime/pkg/client"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/vpc"
Expand Down
10 changes: 7 additions & 3 deletions cloud/scope/powervs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ import (
"context"
"fmt"

"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM-Cloud/power-go-client/ibmpisession"
"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/platform-services-go-sdk/resourcecontrollerv2"
"github.com/go-logr/logr"
"github.com/pkg/errors"

"k8s.io/klog/v2/klogr"

"sigs.k8s.io/controller-runtime/pkg/client"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/controller-runtime/pkg/client"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs"
Expand Down
10 changes: 7 additions & 3 deletions cloud/scope/powervs_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ import (
"context"
"fmt"

"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM-Cloud/power-go-client/ibmpisession"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/platform-services-go-sdk/resourcecontrollerv2"
"github.com/go-logr/logr"
"github.com/pkg/errors"

"k8s.io/klog/v2/klogr"
"sigs.k8s.io/cluster-api/util/patch"

"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/cluster-api/util/patch"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/resourcecontroller"
Expand Down
10 changes: 7 additions & 3 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@ import (
"strconv"
"strings"

"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM-Cloud/power-go-client/ibmpisession"
"github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances"
"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/platform-services-go-sdk/resourcecontrollerv2"
"github.com/go-logr/logr"
"github.com/pkg/errors"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2/klogr"
"k8s.io/utils/pointer"

"sigs.k8s.io/controller-runtime/pkg/client"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util/patch"
"sigs.k8s.io/controller-runtime/pkg/client"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs"
Expand Down
7 changes: 5 additions & 2 deletions controllers/ibmpowervscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ import (

"github.com/go-logr/logr"
"github.com/pkg/errors"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/client-go/tools/record"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util"

ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints"
Expand Down
12 changes: 8 additions & 4 deletions controllers/ibmpowervsimage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,25 @@ import (
"fmt"
"time"

"github.com/IBM-Cloud/power-go-client/power/models"
"github.com/go-logr/logr"
"github.com/pkg/errors"

"github.com/IBM-Cloud/power-go-client/power/models"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/record"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1util "sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"

ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1util "sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"

infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope"
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints"
Expand Down
Loading

0 comments on commit b25a65d

Please sign in to comment.