Skip to content

Commit 8397214

Browse files
committed
Golangci-lint update (gci/goimport linter)
Runs `golangci-lint run --fix` to re-order package imports. Fix is wrongly removing some packages so they had to be manually fixed. Link: golangci/golangci-lint#2161
1 parent 04bcfe6 commit 8397214

17 files changed

+39
-30
lines changed

.golangci.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ linters:
1616
linters-settings:
1717
exhaustive:
1818
default-signifies-exhaustive: true
19+
goimports:
20+
local-prefixes: github.com/crunchydata/postgres-operator
1921
gomodguard:
2022
blocked:
2123
modules:

internal/controller/postgrescluster/cluster_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import (
2424
"testing"
2525
"time"
2626

27-
"github.com/crunchydata/postgres-operator/internal/initialize"
28-
"github.com/crunchydata/postgres-operator/internal/naming"
29-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
3027
"github.com/pkg/errors"
3128
"go.opentelemetry.io/otel"
3229
"gotest.tools/v3/assert"
@@ -43,6 +40,10 @@ import (
4340
"sigs.k8s.io/controller-runtime/pkg/client"
4441
"sigs.k8s.io/controller-runtime/pkg/manager"
4542
"sigs.k8s.io/controller-runtime/pkg/reconcile"
43+
44+
"github.com/crunchydata/postgres-operator/internal/initialize"
45+
"github.com/crunchydata/postgres-operator/internal/naming"
46+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
4647
)
4748

4849
var gvks = []schema.GroupVersionKind{{

internal/controller/postgrescluster/controller_ref_manager_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"go.opentelemetry.io/otel"
2424
"gotest.tools/v3/assert"
25-
2625
appsv1 "k8s.io/api/apps/v1"
2726
corev1 "k8s.io/api/core/v1"
2827
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

internal/controller/postgrescluster/pgmonitor.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import (
2020
"fmt"
2121
"io"
2222

23+
"github.com/pkg/errors"
24+
corev1 "k8s.io/api/core/v1"
25+
"k8s.io/apimachinery/pkg/api/resource"
26+
"sigs.k8s.io/controller-runtime/pkg/client"
27+
2328
"github.com/crunchydata/postgres-operator/internal/config"
2429
"github.com/crunchydata/postgres-operator/internal/initialize"
2530
"github.com/crunchydata/postgres-operator/internal/logging"
@@ -29,10 +34,6 @@ import (
2934
pgpassword "github.com/crunchydata/postgres-operator/internal/postgres/password"
3035
"github.com/crunchydata/postgres-operator/internal/util"
3136
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
32-
"github.com/pkg/errors"
33-
corev1 "k8s.io/api/core/v1"
34-
"k8s.io/apimachinery/pkg/api/resource"
35-
"sigs.k8s.io/controller-runtime/pkg/client"
3637
)
3738

3839
const (

internal/controller/postgrescluster/pgmonitor_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ import (
2626
"strings"
2727
"testing"
2828

29-
"github.com/crunchydata/postgres-operator/internal/initialize"
30-
"github.com/crunchydata/postgres-operator/internal/naming"
31-
"github.com/crunchydata/postgres-operator/internal/pgmonitor"
32-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
3329
"go.opentelemetry.io/otel"
3430
"gotest.tools/v3/assert"
3531
appsv1 "k8s.io/api/apps/v1"
@@ -40,6 +36,11 @@ import (
4036
"k8s.io/apimachinery/pkg/types"
4137
"sigs.k8s.io/controller-runtime/pkg/client"
4238
"sigs.k8s.io/controller-runtime/pkg/manager"
39+
40+
"github.com/crunchydata/postgres-operator/internal/initialize"
41+
"github.com/crunchydata/postgres-operator/internal/naming"
42+
"github.com/crunchydata/postgres-operator/internal/pgmonitor"
43+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
4344
)
4445

4546
func TestAddPGMonitorExporterToInstancePodSpec(t *testing.T) {

internal/controller/postgrescluster/pki_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ import (
2727
"time"
2828

2929
"github.com/pkg/errors"
30-
apierrors "k8s.io/apimachinery/pkg/api/errors"
31-
"k8s.io/apimachinery/pkg/util/wait"
32-
3330
"gotest.tools/v3/assert"
3431
appsv1 "k8s.io/api/apps/v1"
3532
corev1 "k8s.io/api/core/v1"
33+
apierrors "k8s.io/apimachinery/pkg/api/errors"
3634
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3735
"k8s.io/apimachinery/pkg/types"
36+
"k8s.io/apimachinery/pkg/util/wait"
3837
"sigs.k8s.io/controller-runtime/pkg/client"
3938

4039
"github.com/crunchydata/postgres-operator/internal/naming"

internal/controller/postgrescluster/suite_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ import (
2828
"k8s.io/apimachinery/pkg/util/version"
2929
"k8s.io/client-go/discovery"
3030
"k8s.io/client-go/kubernetes/scheme"
31+
32+
// Google Kubernetes Engine / Google Cloud Platform authentication provider
33+
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
3134
"k8s.io/client-go/rest"
3235
"sigs.k8s.io/controller-runtime/pkg/client"
3336
"sigs.k8s.io/controller-runtime/pkg/envtest"
3437
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
3538
"sigs.k8s.io/controller-runtime/pkg/log"
3639
"sigs.k8s.io/controller-runtime/pkg/manager"
3740

38-
// Google Kubernetes Engine / Google Cloud Platform authentication provider
39-
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
40-
4141
"github.com/crunchydata/postgres-operator/internal/logging"
4242
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
4343
)

internal/pgbackrest/helpers_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525

2626
// Google Kubernetes Engine / Google Cloud Platform authentication provider
2727
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
28-
2928
"sigs.k8s.io/controller-runtime/pkg/client"
3029
"sigs.k8s.io/controller-runtime/pkg/envtest"
3130
"sigs.k8s.io/yaml"

internal/pgbackrest/rbac_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import (
1919
"strings"
2020
"testing"
2121

22-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2322
"gotest.tools/v3/assert"
23+
24+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2425
)
2526

2627
func isUniqueAndSorted(slice []string) bool {

internal/pgbackrest/reconcile_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import (
1919
"fmt"
2020
"testing"
2121

22-
"github.com/crunchydata/postgres-operator/internal/naming"
23-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2422
"gotest.tools/v3/assert"
2523
corev1 "k8s.io/api/core/v1"
2624
"k8s.io/apimachinery/pkg/api/equality"
2725
"k8s.io/apimachinery/pkg/api/resource"
2826
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27+
28+
"github.com/crunchydata/postgres-operator/internal/naming"
29+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2930
)
3031

3132
func TestAddRepoVolumesToPod(t *testing.T) {

internal/pgbackrest/ssh_config.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ import (
2222
"crypto/rand"
2323
"fmt"
2424

25+
"golang.org/x/crypto/ssh"
26+
corev1 "k8s.io/api/core/v1"
27+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+
2529
"github.com/crunchydata/postgres-operator/internal/initialize"
2630
"github.com/crunchydata/postgres-operator/internal/naming"
2731
"github.com/crunchydata/postgres-operator/internal/pki"
2832
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
29-
"golang.org/x/crypto/ssh"
30-
corev1 "k8s.io/api/core/v1"
31-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3233
)
3334

3435
const (

internal/pgbackrest/ssh_config_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"crypto/x509"
2323
"encoding/pem"
2424
"fmt"
25-
2625
"reflect"
2726
"strings"
2827
"testing"

internal/pgbackrest/util.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
"hash/fnv"
2121
"io"
2222

23-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2423
"github.com/pkg/errors"
2524
"k8s.io/apimachinery/pkg/util/rand"
25+
26+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2627
)
2728

2829
// maxPGBackrestRepos is the maximum number of repositories that can be configured according to the

internal/pgbackrest/util_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import (
2121
"strconv"
2222
"testing"
2323

24-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2524
"gotest.tools/v3/assert"
2625
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26+
27+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2728
)
2829

2930
func TestCalculateConfigHashes(t *testing.T) {

internal/pgmonitor/postgres_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import (
1919
"strings"
2020
"testing"
2121

22+
"gotest.tools/v3/assert"
23+
2224
"github.com/crunchydata/postgres-operator/internal/postgres"
2325
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
24-
"gotest.tools/v3/assert"
2526
)
2627

2728
func TestPostgreSQLHBA(t *testing.T) {

internal/pgmonitor/util_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ package pgmonitor
1818
import (
1919
"testing"
2020

21-
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2221
"gotest.tools/v3/assert"
22+
23+
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2324
)
2425

2526
func TestExporterEnabled(t *testing.T) {

internal/postgres/password/md5.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package password
1616
*/
1717

1818
import (
19+
1920
// #nosec G501
2021
"crypto/md5"
2122
"errors"

0 commit comments

Comments
 (0)