Skip to content

Commit

Permalink
chore: forcing imports sorting using gci
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
  • Loading branch information
phisco committed Jul 20, 2022
1 parent 8a3554a commit 17ff9af
Show file tree
Hide file tree
Showing 102 changed files with 176 additions and 248 deletions.
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
linters-settings:
lll:
line-length: 120
gci:
sections:
- standard
- default
- prefix(github.com/cloudnative-pg/cloudnative-pg)

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
Expand All @@ -16,6 +21,7 @@ linters:
- durationcheck
- errcheck
- exportloopref
- gci
- gocognit
- goconst
- gocritic
Expand Down Expand Up @@ -75,7 +81,6 @@ linters:
# - exhaustive
# - exhaustivestruct
# - funlen
# - gci
# - gochecknoglobals
# - gochecknoinits
# - godot
Expand Down
5 changes: 2 additions & 3 deletions api/v1/cluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ limitations under the License.
package v1

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("PostgreSQL cluster type", func() {
Expand Down
3 changes: 1 addition & 2 deletions api/v1/pooler_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ limitations under the License.
package v1

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

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ = Describe("Pooler validation", func() {
Expand Down
3 changes: 1 addition & 2 deletions cmd/kubectl-cnpg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ package main
import (
"os"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/maintenance"

"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/certificate"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/fence"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/maintenance"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/promote"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/reload"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/report"
Expand Down
3 changes: 1 addition & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"

"github.com/spf13/cobra"
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/backup"
Expand All @@ -31,8 +32,6 @@ import (
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/walarchive"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/walrestore"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/versions"

_ "k8s.io/client-go/plugin/pkg/client/auth"
)

func main() {
Expand Down
5 changes: 2 additions & 3 deletions controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("Filtering cluster", func() {
Expand Down
5 changes: 2 additions & 3 deletions controllers/cluster_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ package controllers
import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
"k8s.io/apimachinery/pkg/types"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("cluster_create unit tests", func() {
Expand Down
1 change: 0 additions & 1 deletion controllers/cluster_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
5 changes: 2 additions & 3 deletions controllers/cluster_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ package controllers
import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("cluster_scale unit tests", func() {
Expand Down
1 change: 0 additions & 1 deletion controllers/cluster_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down
6 changes: 3 additions & 3 deletions controllers/cluster_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/pkg/postgres"
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("Pod upgrade", func() {
Expand Down
1 change: 0 additions & 1 deletion controllers/pooler_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down
1 change: 0 additions & 1 deletion controllers/pooler_predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package controllers
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/rand"
Expand Down
1 change: 0 additions & 1 deletion controllers/pooler_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
1 change: 0 additions & 1 deletion controllers/pooler_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down
1 change: 0 additions & 1 deletion controllers/pooler_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down
5 changes: 2 additions & 3 deletions controllers/replicas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ limitations under the License.
package controllers

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/cloudnative-pg/cloudnative-pg/pkg/postgres"
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("Sacrificial Pod detection", func() {
Expand Down
7 changes: 2 additions & 5 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
Expand All @@ -42,11 +44,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/manager"

// +kubebuilder:scaffold:imports

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/pkg/certs"
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs"
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"github.com/spf13/pflag"
"go.uber.org/zap/zapcore"

"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/manager/pgbouncer/run/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"io"
"os"

"github.com/cloudnative-pg/cloudnative-pg/pkg/management/logtest"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/cloudnative-pg/cloudnative-pg/pkg/management/logtest"
)

var _ = Describe("pgbouncer log parsing", func() {
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/manager/show/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ limitations under the License.
package show

import (
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/show/walarchivequeue"
"github.com/spf13/cobra"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/show/walarchivequeue"
)

// NewCmd creates the new cobra command
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/manager/walarchive/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"github.com/spf13/cobra"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/manager/walrestore/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ limitations under the License.
package walrestore

import (
apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
)

var _ = Describe("Function isStreamingAvailable", func() {
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/plugin/maintenance/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ import (
"github.com/cheynewallace/tabby"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin"

v1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin"
)

// Maintenance command implementation
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/plugin/report/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (
"io"
"path/filepath"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin"
"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"

batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin"
"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"
)

const jobMatcherLabel = "job-name"
Expand Down
5 changes: 2 additions & 3 deletions internal/cmd/plugin/report/redactors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ limitations under the License.
package report

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

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
admissionv1 "k8s.io/api/admissionregistration/v1"
corev1 "k8s.io/api/core/v1"
)

var _ = Describe("Redact Secret", func() {
Expand Down
5 changes: 2 additions & 3 deletions internal/cmd/plugin/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import (
"path/filepath"
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down
1 change: 0 additions & 1 deletion internal/management/controller/instance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"time"

"github.com/lib/pq"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
Expand Down
3 changes: 1 addition & 2 deletions internal/management/controller/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import (
"context"
"fmt"

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

"go.uber.org/atomic"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"

Expand Down
3 changes: 1 addition & 2 deletions internal/management/utils/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ limitations under the License.
package utils

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

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
)

var _ = Describe("basic-auth secrets decoding", func() {
Expand Down

0 comments on commit 17ff9af

Please sign in to comment.