Skip to content
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

bump golangci-lint to v1.55.2 and fix new lint issues #5941

Merged
merged 2 commits into from
Nov 7, 2023
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 .github/workflows/prbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.55.2
# TODO: re-enable linting tools package once https://github.com/projectcontour/contour/issues/5077
# is resolved
args: --build-tags=e2e,conformance,gcp,oidc,none
Expand Down
12 changes: 6 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ linters-settings:

issues:
exclude-rules:
- linters:
- unparam
- linters: ["unparam"]
text: "always receives"
- path: zz_generated
linters:
- goimports
linters: ["goimports"]
- path: test/e2e
linters:
- bodyclose
linters: ["bodyclose"]
- path: test/e2e
linters: ["revive"]
text: "should not use dot imports"
2 changes: 1 addition & 1 deletion hack/golangci-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /usr/bin/env bash

go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 "$@"
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 "$@"
1 change: 1 addition & 0 deletions internal/dag/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ func TestHeadersPolicy(t *testing.T) {
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
tc := tc
got, gotErr := headersPolicyService(&tc.dhp, tc.hp, true, dynamicHeaders)
if tc.wantErr {
assert.Error(t, gotErr)
Expand Down
1 change: 1 addition & 0 deletions internal/envoy/v3/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,7 @@ func TestBootstrap(t *testing.T) {

for name, tc := range tests {
t.Run(name, func(t *testing.T) {
tc := tc
steps, gotError := bootstrap(&tc.config)
assert.Equal(t, gotError != nil, tc.wantedError)

Expand Down
1 change: 1 addition & 0 deletions internal/envoy/v3/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ func FilterJWTAuth(jwtProviders []dag.JWTProvider) *http.HttpFilter {
}

for _, provider := range jwtProviders {
provider := provider
var cacheDuration *durationpb.Duration
if provider.RemoteJWKS.CacheDuration != nil {
cacheDuration = durationpb.New(*provider.RemoteJWKS.CacheDuration)
Expand Down
2 changes: 1 addition & 1 deletion internal/featuretests/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func IngressBackend(svc *v1.Service) *networking_v1.IngressBackend {
}
}

// nolint:revive
// nolint:revive,gosec
const (
// CERTIFICATE generated by
// openssl genrsa -out example-key.pem 2048
Expand Down
2 changes: 1 addition & 1 deletion internal/fixture/certificate_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package fixture

// nolint:revive
// nolint:revive,gosec
const (
// CERTIFICATE generated by
// openssl genrsa -out example-key.pem 2048
Expand Down
1 change: 1 addition & 0 deletions internal/xdscache/v3/endpointslicetranslator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ func TestEndpointSliceTranslatorRecomputeClusterLoadAssignment(t *testing.T) {
}

for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
endpointSliceTranslator := NewEndpointSliceTranslator(fixture.NewTestLogger(t))
require.NoError(t, endpointSliceTranslator.cache.SetClusters([]*dag.ServiceCluster{&tc.cluster}))
Expand Down
2 changes: 2 additions & 0 deletions internal/xdscache/v3/endpointstranslator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,10 @@ func TestEndpointsTranslatorRecomputeClusterLoadAssignment(t *testing.T) {
}

for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
et := NewEndpointsTranslator(fixture.NewTestLogger(t))
// nolint:gosec
require.NoError(t, et.cache.SetClusters([]*dag.ServiceCluster{&tc.cluster}))
et.OnAdd(tc.ep, false)
got := et.Contents()
Expand Down
2 changes: 1 addition & 1 deletion internal/xdscache/v3/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func backend(name string, port int32) *networking_v1.IngressBackend {
}
}

// nolint:revive
// nolint:revive,gosec
const (
// CERTIFICATE generated by
// openssl genrsa -out example-key.pem 2048
Expand Down
Loading