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

chore(linter): switching from goimports to gci enforcing imports sorting #415

Merged
merged 1 commit into from
Mar 29, 2023
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
14 changes: 9 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ linters-settings:
# simplify code: gofmt with `-s` option, true by default
simplify: true

goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/crossplane/crossplane
gci:
custom-order: true
sections:
- standard
- default
- prefix(github.com/crossplane/crossplane-runtime)
- blank
- dot

gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
Expand Down Expand Up @@ -110,7 +114,7 @@ linters:
- gocyclo
- gocritic
- goconst
- goimports
- gci
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- revive
Expand Down
1 change: 0 additions & 1 deletion apis/common/v1/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package v1

import (
corev1 "k8s.io/api/core/v1"

"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
)
Expand Down
3 changes: 1 addition & 2 deletions pkg/connection/store/vault/kv/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"encoding/json"
"path/filepath"

"github.com/crossplane/crossplane-runtime/pkg/fieldpath"

"github.com/hashicorp/vault/api"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/fieldpath"
"github.com/crossplane/crossplane-runtime/pkg/resource"
)

Expand Down
7 changes: 3 additions & 4 deletions pkg/reconciler/managed/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import (
"testing"
"time"

kerrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

Expand Down
1 change: 0 additions & 1 deletion pkg/reference/reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"strconv"

kerrors "k8s.io/apimachinery/pkg/api/errors"

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

Expand Down
3 changes: 1 addition & 2 deletions pkg/resource/late_initializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import (
"testing"
"time"

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

"github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestLateInitializeStringPtr(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/test/integration/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/manager"

// Allow auth to cloud providers
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/resource"

// Allow auth to cloud providers
_ "k8s.io/client-go/plugin/pkg/client/auth"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions pkg/webhook/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import (
"context"
"testing"

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

"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/test"
Expand Down