Skip to content

Commit

Permalink
Set gci linter prefix value
Browse files Browse the repository at this point in the history
This sets the correct prefix value for the gci linter's namespace.

Good practice is to have imports separated into three distinct groups:
standard library imports, third party package imports, and local
imports. The gci linter is used to enforce this convention, making it
easy to see what is local, what is standard with go, and what is being
pulled in externally.

The gci linter configuration has a "prefix" setting that is used to tell
it what to match as the starting string to identify local imports. This
was set to "false", effectively disabling the ability to differentiate
local imports from third party ones.

This change sets the "prefix" value to our "sigs.k8s.io/cluster-api"
path so that our local imports are identified and grouped separately.

Signed-off-by: Sean McGinnis <[email protected]>
  • Loading branch information
stmcginnis committed Dec 8, 2021
1 parent 891f585 commit 5026786
Show file tree
Hide file tree
Showing 495 changed files with 970 additions and 476 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ linters-settings:
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
max-decl-chars: 50
gci:
local-prefixes: "false"
local-prefixes: "sigs.k8s.io/cluster-api"
importas:
no-unaliased: true
alias:
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha3/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package v1alpha3

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

"sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/util/conditions"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error {
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha3/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"sigs.k8s.io/controller-runtime/pkg/conversion"

"sigs.k8s.io/cluster-api/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func TestFuzzyConversion(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha3/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha3
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha3/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation/field"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha3/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
// +kubebuilder:scaffold:imports
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/cluster-api/internal/envtest"
ctrl "sigs.k8s.io/controller-runtime"

"sigs.k8s.io/cluster-api/internal/envtest"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha3/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/controller-runtime/pkg/client"

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

func TestClusterConversion(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

capierrors "sigs.k8s.io/cluster-api/errors"
)

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

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

"sigs.k8s.io/cluster-api/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error {
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/utils/pointer"

"sigs.k8s.io/cluster-api/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha4
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation/field"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/util/version"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/util/version"
)

// Deprecated: This file, including all public and private methods, will be removed in a future release.
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/cluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilfeature "k8s.io/component-base/featuregate/testing"

"sigs.k8s.io/cluster-api/feature"
utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/clusterclass_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/cluster-api/feature"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"sigs.k8s.io/cluster-api/feature"
)

// Deprecated: This file, including all public and private methods, will be removed in a future release.
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/clusterclass_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilfeature "k8s.io/component-base/featuregate/testing"

"sigs.k8s.io/cluster-api/feature"
utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"fmt"

"github.com/pkg/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

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

const (
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"testing"

. "github.com/onsi/gomega"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"

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

func TestClusterByClassName(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ package index
import (
"context"

"sigs.k8s.io/cluster-api/feature"
ctrl "sigs.k8s.io/controller-runtime"

"sigs.k8s.io/cluster-api/feature"
)

// AddDefaultIndexes registers the default list of indexes.
Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/index/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (

"github.com/pkg/errors"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
"sigs.k8s.io/controller-runtime/pkg/client"
)

func TestIndexMachineByNodeName(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"fmt"

corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/cluster-api/controllers/noderefutil"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/index/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (

. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/cluster-api/controllers/noderefutil"
)

func TestIndexNodeByProviderID(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/machine_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"

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/machine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/cluster-api/util/version"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"sigs.k8s.io/cluster-api/util/version"
)

func (m *Machine) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/machine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)

Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/machinedeployment_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/utils/pointer"
"sigs.k8s.io/cluster-api/util/version"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"sigs.k8s.io/cluster-api/util/version"
)

func (m *MachineDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/machinedeployment_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"

utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/machinehealthcheck_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"

utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)

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

capierrors "sigs.k8s.io/cluster-api/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/machineset_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/cluster-api/util/version"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"sigs.k8s.io/cluster-api/util/version"
)

func (m *MachineSet) SetupWebhookWithManager(mgr ctrl.Manager) error {
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/machineset_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)

Expand Down
3 changes: 2 additions & 1 deletion bootstrap/kubeadm/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package v1alpha3

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

"sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/upstreamv1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error {
Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1alpha3/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
fuzz "github.com/google/gofuzz"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"

"sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/upstreamv1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_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"

clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
"sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/upstreamv1beta1"
)
Expand Down
3 changes: 2 additions & 1 deletion bootstrap/kubeadm/api/v1alpha3/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
// +kubebuilder:scaffold:imports
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/cluster-api/internal/envtest"
ctrl "sigs.k8s.io/controller-runtime"

"sigs.k8s.io/cluster-api/internal/envtest"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion bootstrap/kubeadm/api/v1alpha3/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"

"sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/upstreamv1beta1"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/controller-runtime/pkg/client"
)

func TestKubeadmConfigConversion(t *testing.T) {
Expand Down
Loading

0 comments on commit 5026786

Please sign in to comment.