Skip to content

Remove deprecated linter and fix issues #2433

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

Merged
merged 2 commits into from
Aug 20, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ linters:
enable:
- asasalint
- asciicheck
- copyloopvar
- dupword
- errcheck
- errname
- errorlint
- exportloopref
- fatcontext
- ginkgolinter
- gocheckcompilerdirectives
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
- javascript

- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
rev: v1.60.2
hooks:
- id: golangci-lint-full
name: golangci-lint-root
Expand Down
3 changes: 0 additions & 3 deletions cmd/gateway/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ func TestCommonFlagsValidation(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name+"_static_mode", func(t *testing.T) {
t.Parallel()
testFlag(t, createStaticModeCommand(), test)
Expand Down Expand Up @@ -387,7 +386,6 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
// common flags validation is tested separately

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
cmd := createStaticModeCommand()
Expand Down Expand Up @@ -461,7 +459,6 @@ func TestSleepCmdFlagValidation(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
cmd := createSleepCommand()
Expand Down
9 changes: 0 additions & 9 deletions cmd/gateway/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestValidateGatewayControllerName(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -118,7 +117,6 @@ func TestValidateResourceName(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -184,7 +182,6 @@ func TestValidateNamespaceName(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -249,7 +246,6 @@ func TestParseNamespacedResourceName(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -317,7 +313,6 @@ func TestValidateQualifiedName(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -382,7 +377,6 @@ func TestValidateURL(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -425,7 +419,6 @@ func TestValidateIP(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -495,7 +488,6 @@ func TestValidateEndpoint(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -535,7 +527,6 @@ func TestValidatePort(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/controller/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestCreateSingleResourceFilter(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func TestServiceNameIndexFunc(t *testing.T) {
}

for _, tc := range testcases {
tc := tc
t.Run(tc.msg, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
2 changes: 0 additions & 2 deletions internal/framework/controller/predicate/annotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func TestAnnotationPredicate_Create(t *testing.T) {
p := AnnotationPredicate{Annotation: annotation}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -215,7 +214,6 @@ func TestAnnotationPredicate_Update(t *testing.T) {
p := AnnotationPredicate{Annotation: annotation}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
2 changes: 0 additions & 2 deletions internal/framework/controller/predicate/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func TestServicePortsChangedPredicate_Update(t *testing.T) {
p := ServicePortsChangedPredicate{}

for _, tc := range testcases {
tc := tc
t.Run(tc.msg, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down Expand Up @@ -445,7 +444,6 @@ func TestGatewayServicePredicate_Update(t *testing.T) {
p := GatewayServicePredicate{NSName: types.NamespacedName{Namespace: "nginx-gateway", Name: "nginx"}}

for _, tc := range testcases {
tc := tc
t.Run(tc.msg, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/controller/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func TestRegister(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.msg, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/gatewayclass/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func TestValidateCRDVersions(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/helpers/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func TestEqualPointers(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/status/conditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func TestConditionsEqual(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
1 change: 0 additions & 1 deletion internal/framework/status/updater_retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func TestNewRetryUpdateFunc(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
g := NewWithT(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/mode/static/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@

// protectedPorts is the map of ports that may not be configured by a listener, and the name of what it is used for
protectedPorts := map[int32]string{
int32(cfg.MetricsConfig.Port): "MetricsPort",
int32(cfg.HealthConfig.Port): "HealthPort",
int32(cfg.MetricsConfig.Port): "MetricsPort", //nolint:gosec // port will not overflow int32
int32(cfg.HealthConfig.Port): "HealthPort", //nolint:gosec // port will not overflow int32

Check warning on line 117 in internal/mode/static/manager.go

View check run for this annotation

Codecov / codecov/patch

internal/mode/static/manager.go#L116-L117

Added lines #L116 - L117 were not covered by tests
}

mustExtractGVK := kinds.NewMustExtractGKV(scheme)
Expand Down
2 changes: 1 addition & 1 deletion internal/mode/static/state/graph/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestBuildGateway(t *testing.T) {
return v1.Listener{
Name: v1.SectionName(name),
Hostname: (*v1.Hostname)(helpers.GetPointer(hostname)),
Port: v1.PortNumber(port),
Port: v1.PortNumber(port), //nolint:gosec // port number will not overflow int32
Protocol: protocol,
TLS: tls,
}
Expand Down
2 changes: 0 additions & 2 deletions internal/mode/static/state/graph/reference_grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ func TestReferenceGrantResolver(t *testing.T) {
resolver := newReferenceGrantResolver(refGrants)

for _, test := range tests {
test := test
t.Run(test.msg, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -415,7 +414,6 @@ func TestRefAllowedFrom(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/mode/static/state/graph/tlsroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ func TestBuildTLSRoute(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
g := NewWithT(t)
t.Parallel()
Expand Down
2 changes: 1 addition & 1 deletion internal/mode/static/status/prepare_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func prepareGatewayRequest(
listenerStatuses = append(listenerStatuses, v1.ListenerStatus{
Name: v1.SectionName(l.Name),
SupportedKinds: l.SupportedKinds,
AttachedRoutes: int32(len(l.Routes)) + int32(len(l.L4Routes)),
AttachedRoutes: int32(len(l.Routes)) + int32(len(l.L4Routes)), //nolint:gosec // num routes will not overflow
Conditions: apiConds,
})
}
Expand Down
1 change: 0 additions & 1 deletion tests/suite/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,6 @@ var _ = Describe("Zero downtime scale test", Ordered, Label("nfr", "zero-downtim
buf := new(bytes.Buffer)
encoder := framework.NewVegetaCSVEncoder(buf)
for _, res := range results {
res := res
Expect(encoder.Encode(&res)).To(Succeed())
}

Expand Down
1 change: 0 additions & 1 deletion tests/suite/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ var _ = Describe("Upgrade testing", Label("nfr", "upgrade"), func() {
buf := new(bytes.Buffer)
encoder := framework.NewVegetaCSVEncoder(buf)
for _, res := range results {
res := res
Expect(encoder.Encode(&res)).To(Succeed())
}

Expand Down
Loading