Skip to content

Commit 77d3bcf

Browse files
authored
Remove deprecated linters, add gocyclo and gofumpt (#213)
varcheck, deadcode, and structcheck have been deprecated.
1 parent ccc1236 commit 77d3bcf

10 files changed

+18
-20
lines changed

.golangci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ linters-settings:
3030
- name: unused-parameter
3131
- name: var-declaration
3232
- name: var-naming
33+
gocyclo:
34+
min-complexity: 15
3335

3436
linters:
3537
enable:
3638
- asciicheck
37-
- deadcode
3839
- errcheck
3940
- errorlint
41+
- gocyclo
4042
- gofmt
43+
- gofumpt
4144
- goimports
4245
- gosec
4346
- gosimple
@@ -50,12 +53,10 @@ linters:
5053
- predeclared
5154
- revive
5255
- staticcheck
53-
- structcheck
5456
- typecheck
5557
- unconvert
5658
- unparam
5759
- unused
58-
- varcheck
5960
- wastedassign
6061
disable-all: true
6162
issues:

cmd/gateway/gateway_suite_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package main_test
22

33
import (
4+
"testing"
5+
46
. "github.com/onsi/ginkgo"
57
. "github.com/onsi/gomega"
6-
7-
"testing"
88
)
99

1010
func TestGateway(t *testing.T) {

cmd/gateway/setup.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ const (
1414
errTmpl = "failed validation - flag: '--%s' reason: '%s'\n"
1515
)
1616

17-
type Validator func(*flag.FlagSet) error
18-
type ValidatorContext struct {
19-
Key string
20-
V Validator
21-
}
17+
type (
18+
Validator func(*flag.FlagSet) error
19+
ValidatorContext struct {
20+
Key string
21+
V Validator
22+
}
23+
)
2224

2325
func GatewayControllerParam(domain string, namespace string) ValidatorContext {
2426
name := "gateway-ctlr-name"

internal/events/events_suit_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package events_test
22

33
import (
4+
"testing"
5+
46
. "github.com/onsi/ginkgo/v2"
57
. "github.com/onsi/gomega"
6-
7-
"testing"
88
)
99

1010
func TestState(t *testing.T) {

internal/events/handler.go

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func NewEventHandlerImpl(cfg EventHandlerConfig) *EventHandlerImpl {
6262
}
6363

6464
func (h *EventHandlerImpl) HandleEventBatch(ctx context.Context, batch EventBatch) {
65-
6665
for _, event := range batch {
6766
switch e := event.(type) {
6867
case *UpsertEvent:

internal/events/handler_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ var _ = Describe("EventHandler", func() {
121121

122122
// Check that a reconfig happened
123123
expectReconfig(fakeConf, fakeCfg, fakeStatuses)
124-
125124
},
126125
Entry("HTTPRoute upsert", &events.UpsertEvent{Resource: &v1beta1.HTTPRoute{}}),
127126
Entry("Gateway upsert", &events.UpsertEvent{Resource: &v1beta1.Gateway{}}),

internal/state/secrets_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ var _ = Describe("SecretStore", func() {
309309

310310
validToInvalidSecret = secret1.DeepCopy()
311311
validToInvalidSecret.Data[apiv1.TLSCertKey] = invalidCert
312-
313312
})
314313
Describe("handles CRUD events on secrets", Ordered, func() {
315314
testUpsert := func(s *apiv1.Secret, valid bool) {

internal/state/services_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ var _ = Describe("ServiceStore", func() {
5757

5858
Expect(address).To(Equal("10.0.0.2"))
5959
Expect(err).To(BeNil())
60-
6160
})
6261

6362
It("should delete the service", func() {

internal/status/clock.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ type Clock interface {
1212
}
1313

1414
// Real clock returns the current local time.
15-
type RealClock struct {
16-
}
15+
type RealClock struct{}
1716

1817
// NewRealClock creates a new RealClock.
1918
func NewRealClock() *RealClock {

internal/status/status_suit_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package status
22

33
import (
4+
"testing"
5+
46
. "github.com/onsi/ginkgo/v2"
57
. "github.com/onsi/gomega"
6-
7-
"testing"
88
)
99

1010
func TestState(t *testing.T) {

0 commit comments

Comments
 (0)