Skip to content

Commit 1cc4c2d

Browse files
authored
Merge pull request #1987 from sonasingh46/gci_linter
chore(golangci-lint): add gci linter and lint fix make target
2 parents f6ac019 + bd23e2f commit 1cc4c2d

File tree

109 files changed

+139
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+139
-253
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ linters:
1616
- errcheck
1717
- errorlint
1818
- exportloopref
19+
- gci
1920
- goconst
2021
- gocyclo
2122
- godot

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ $(YQ_BIN): $(YQ) ## Building yq from the tools folder
297297

298298
.PHONY: lint
299299
lint: $(GOLANGCI_LINT) lint-latest ## Lint codebase
300-
$(GOLANGCI_LINT) run -v
300+
$(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
301+
302+
.PHONY: lint-fix
303+
lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter
304+
GOLANGCI_LINT_EXTRA_ARGS=--fix $(MAKE) lint
301305

302306
lint-full: $(GOLANGCI_LINT) ## Run slower linters to detect possible issues
303307
$(GOLANGCI_LINT) run -v --fast=false

api/v1beta1/azurecluster_default_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"testing"
2323

2424
"github.com/Azure/go-autorest/autorest/to"
25-
2625
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2726
)
2827

api/v1beta1/azurecluster_validation.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ import (
2222
"reflect"
2323
"regexp"
2424

25-
"k8s.io/utils/pointer"
26-
2725
valid "github.com/asaskevich/govalidator"
2826
apierrors "k8s.io/apimachinery/pkg/api/errors"
2927
"k8s.io/apimachinery/pkg/runtime/schema"
3028
"k8s.io/apimachinery/pkg/util/validation/field"
29+
"k8s.io/utils/pointer"
3130
)
3231

3332
const (

api/v1beta1/azurecluster_validation_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ package v1beta1
1919
import (
2020
"testing"
2121

22-
"k8s.io/utils/pointer"
23-
2422
. "github.com/onsi/gomega"
2523
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2624
"k8s.io/apimachinery/pkg/util/validation/field"
25+
"k8s.io/utils/pointer"
2726
)
2827

2928
func TestClusterNameValidation(t *testing.T) {

api/v1beta1/azureimage_validation_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/gomega"
23-
2423
"k8s.io/apimachinery/pkg/util/validation/field"
2524
)
2625

api/v1beta1/azuremachine_default.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121

2222
"golang.org/x/crypto/ssh"
2323
"k8s.io/apimachinery/pkg/util/uuid"
24-
ctrl "sigs.k8s.io/controller-runtime"
25-
2624
utilSSH "sigs.k8s.io/cluster-api-provider-azure/util/ssh"
25+
ctrl "sigs.k8s.io/controller-runtime"
2726
)
2827

2928
// SetDefaultSSHPublicKey sets the default SSHPublicKey for an AzureMachine.

api/v1beta1/azuremachine_default_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
"reflect"
2222
"testing"
2323

24-
"github.com/google/uuid"
25-
2624
"github.com/Azure/go-autorest/autorest/to"
25+
"github.com/google/uuid"
2726
. "github.com/onsi/gomega"
2827
)
2928

api/v1beta1/azuremachine_validation.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ import (
2020
"encoding/base64"
2121
"fmt"
2222

23-
"github.com/google/uuid"
24-
2523
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
24+
"github.com/google/uuid"
2625
"golang.org/x/crypto/ssh"
2726
"k8s.io/apimachinery/pkg/util/validation/field"
2827
)

api/v1beta1/azuremachine_validation_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ import (
2323
"fmt"
2424
"testing"
2525

26-
"github.com/google/uuid"
27-
2826
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
2927
"github.com/Azure/go-autorest/autorest/to"
30-
28+
"github.com/google/uuid"
3129
. "github.com/onsi/gomega"
3230
"golang.org/x/crypto/ssh"
3331
"k8s.io/apimachinery/pkg/util/validation/field"

0 commit comments

Comments
 (0)