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: forcing imports sorting using gci #440

Merged
merged 3 commits into from
Aug 2, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
linters-settings:
lll:
line-length: 120
gci:
sections:
- standard
- default
- prefix(github.com/cloudnative-pg/cloudnative-pg)
- blank
- dot

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

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

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

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

var _ = Describe("ensuring the correctness of synchronous replica data calculation", func() {
Expand Down
5 changes: 3 additions & 2 deletions api/v1/cluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ package v1
import (
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/cloudnative-pg/cloudnative-pg/internal/configuration"

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

var _ = Describe("bootstrap methods validation", func() {
Expand Down
4 changes: 2 additions & 2 deletions api/v1/scheduledbackup_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package v1

import (
"github.com/cloudnative-pg/cloudnative-pg/internal/configuration"

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

"github.com/cloudnative-pg/cloudnative-pg/internal/configuration"
)

var _ = Describe("Scheduled backup", func() {
Expand Down
4 changes: 2 additions & 2 deletions api/v1/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"fmt"
"testing"

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

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

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

func TestApi(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/kubectl-cnpg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ 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"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/restart"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/plugin/status"
"github.com/cloudnative-pg/cloudnative-pg/internal/cmd/versions"

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

func main() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/cluster_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import (
"context"
"time"

. "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"
"sigs.k8s.io/controller-runtime/pkg/manager"

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

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

var _ = Describe("ensures that deleteDanglingMonitoringQueries works correctly", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/cluster_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ 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"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -30,6 +27,9 @@ import (

v1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/pkg/certs"

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

var _ = Describe("cluster_status unit tests", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/pooler_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ package controllers
import (
"context"

. "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"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

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

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

var _ = Describe("pooler_controller unit tests", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/pooler_predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ 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"
"k8s.io/apimachinery/pkg/util/rand"
"sigs.k8s.io/controller-runtime/pkg/client"

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

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

var _ = Describe("pooler_predicates unit tests", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/pooler_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ package controllers
import (
"context"

. "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"

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

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

var _ = Describe("pooler_resources unit tests", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/pooler_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ package controllers
import (
"context"

. "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"

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

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

var _ = Describe("pooler_status unit tests", func() {
Expand Down
6 changes: 3 additions & 3 deletions controllers/pooler_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ package controllers
import (
"context"

. "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 All @@ -31,6 +28,9 @@ import (

"github.com/cloudnative-pg/cloudnative-pg/internal/configuration"
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs/pgbouncer"

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

var _ = Describe("unit test of pooler_update reconciliation logic", func() {
Expand Down
7 changes: 3 additions & 4 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ import (
"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"

. "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/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
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
1 change: 1 addition & 0 deletions internal/cmd/manager/walrestore/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package walrestore

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

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
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
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 pkg/management/barman/credentials/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
"context"
"fmt"

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

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

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

Expand Down
3 changes: 2 additions & 1 deletion pkg/management/pgbouncer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
"strings"
"text/template"

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

apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
"github.com/cloudnative-pg/cloudnative-pg/pkg/certs"
"github.com/cloudnative-pg/cloudnative-pg/pkg/postgres"
corev1 "k8s.io/api/core/v1"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/management/pgbouncer/config/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package config

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

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

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

var _ = Describe("Secret type detection", func() {
Expand Down