Skip to content

Commit

Permalink
chore(*) lint fixes (#1599)
Browse files Browse the repository at this point in the history
* chore: remove gomnd linter

* chore: disable gochecknoinits lint

* fix: enable lint on internal/ & hack/ dirs

* chore: non-functional lint fixes

* chore: goimports -local

* chore: drop gci lint in favor of goimports

* fix: goimports

* fix: lint errors for diag server

* chore: remove old client code

* fix: use status code var instead of bare int
  • Loading branch information
shaneutt committed Jul 28, 2021
1 parent 10c0b42 commit bc19341
Show file tree
Hide file tree
Showing 108 changed files with 156 additions and 3,899 deletions.
5 changes: 0 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ run:
skip-dirs:
- pkg/client
- pkg/apis
- internal/ # TODO: https://github.com/Kong/kubernetes-ingress-controller/issues/1597
- hack/ # TODO: https://github.com/Kong/kubernetes-ingress-controller/issues/1597
linters:
enable:
- asciicheck
Expand All @@ -16,11 +14,8 @@ linters:
- errcheck
- exhaustive
- exportloopref
- gci
- gochecknoinits
- gofmt
- goimports
- gomnd
- gosec
- gosimple
- govet
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
TAG?=2.0.0-alpha.3
REGISTRY?=kong
REPO_INFO=$(shell git config --get remote.origin.url)
REPO_URL=github.com/kong/kubernetes-ingress-controller
IMGNAME?=kubernetes-ingress-controller
IMAGE = $(REGISTRY)/$(IMGNAME)
IMG ?= controller:latest
Expand Down Expand Up @@ -69,6 +70,10 @@ build: generate fmt vet lint
-X github.com/kong/kubernetes-ingress-controller/internal/manager.Commit=$(COMMIT) \
-X github.com/kong/kubernetes-ingress-controller/internal/manager.Repo=$(REPO_INFO)" internal/cmd/main.go

.PHONY: imports
imports:
@find ./ -type f -name '*.go' -exec goimports -local $(REPO_URL) -w {} \;

.PHONY: fmt
fmt:
go fmt ./...
Expand Down
4 changes: 3 additions & 1 deletion internal/admission/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"io/ioutil"
"net/http"

configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
"github.com/sirupsen/logrus"
admission "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"

configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
)

var (
Expand Down Expand Up @@ -173,6 +174,7 @@ func (a RequestHandler) handleValidation(ctx context.Context, request admission.
var message string
var err error

//nolint:exhaustive
switch request.Resource {
case consumerGVResource:
consumer := configuration.KongConsumer{}
Expand Down
3 changes: 2 additions & 1 deletion internal/admission/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"net/http/httptest"
"testing"

configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
"github.com/lithammer/dedent"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
admission "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
)

var decoder = codecs.UniversalDeserializer()
Expand Down
3 changes: 2 additions & 1 deletion internal/annotations/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func TestIngressClassValidatorFunc(t *testing.T) {

data := map[string]string{}
ing.SetAnnotations(data)
for _, test := range tests {
for i := 0; i < len(tests); i++ {
test := tests[i]
ing.Annotations[IngressClassKey] = test.ingress
ingv1.Spec.IngressClassName = &test.ingress
// TODO: unclear if we truly use IngressClassValidatorFunc anymore
Expand Down
111 changes: 0 additions & 111 deletions internal/client/configuration/clientset/versioned/clientset.go

This file was deleted.

20 changes: 0 additions & 20 deletions internal/client/configuration/clientset/versioned/doc.go

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions internal/client/configuration/clientset/versioned/fake/doc.go

This file was deleted.

58 changes: 0 additions & 58 deletions internal/client/configuration/clientset/versioned/fake/register.go

This file was deleted.

Loading

0 comments on commit bc19341

Please sign in to comment.