Skip to content

Commit

Permalink
Upgrade linter to a version that supports go 1.23
Browse files Browse the repository at this point in the history
Signed-off-by: Ignasi Barrera <[email protected]>
  • Loading branch information
nacx committed Sep 9, 2024
1 parent 1d35471 commit 9c742e8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
12 changes: 4 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

run:
skip-files:
issues:
exclude-files:
- ".*\\.pb.*\\.go"
linters:
enable:
Expand All @@ -29,20 +29,16 @@ linters:
- unused
- staticcheck
- gosimple
- megacheck
disable:
- interfacer # deprecated since it "is prone to bad suggestions"
- goimports # already run in `make format`
- deadcode # Deprecated. Author abandoned it.
- structcheck # Deprecated. Author abandoned it.
- varcheck # Deprecated. Author abandoned it.
linters-settings:
lll:
line-length: 160
goconst:
min-occurrences: 4
govet:
check-shadowing: true
enable:
- shadow
revive:
ignore-generated-header: false
severity: error
Expand Down
2 changes: 1 addition & 1 deletion e2e/testclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (a *AddressMappings) DialContext(ctx context.Context, network, addr string)

// DialTLSContext is a custom dialer that resolves specific host:port to specific target addresses.
func (a *AddressMappings) DialTLSContext(tlsConfig *tls.Config) func(context.Context, string, string) (net.Conn, error) {
return func(ctx context.Context, network, addr string) (net.Conn, error) {
return func(_ context.Context, network, addr string) (net.Conn, error) {
cfg := tlsConfig.Clone()
if resolved, ok := a.addresses[addr]; ok {
// Use the original hostname for the SNI, to avoid certificate verification errors
Expand Down
2 changes: 1 addition & 1 deletion env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NAME ?= authservice

-include $(ROOT)/.makerc # Pick up any local overrides.

GOLANGCI_LINT ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
GOLANGCI_LINT ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
GOSIMPORTS ?= github.com/rinchsan/gosimports/cmd/[email protected]
LICENSER ?= github.com/liamawhite/[email protected]
KIND ?= sigs.k8s.io/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions internal/authz/oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ func newServer(wellKnownPayload string) *idpServer {
idpServer := &idpServer{server: s, listener: bufconn.Listen(1024)}

handler := http.NewServeMux()
handler.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) {
handler.HandleFunc("/token", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(idpServer.statusCode)

Expand All @@ -1656,7 +1656,7 @@ func newServer(wellKnownPayload string) *idpServer {
}
}
})
handler.HandleFunc("/.well-known/openid-configuration", func(w http.ResponseWriter, r *http.Request) {
handler.HandleFunc("/.well-known/openid-configuration", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(wellKnownPayload))
Expand Down
2 changes: 1 addition & 1 deletion internal/oidc/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func newServer() *idpServer {
idpServer := &idpServer{server: s, listener: bufconn.Listen(1024)}

handler := http.NewServeMux()
handler.HandleFunc("/.well-known/openid-configuration", func(w http.ResponseWriter, r *http.Request) {
handler.HandleFunc("/.well-known/openid-configuration", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
if idpServer.wellKnownConfig != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/oidc/jwks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestDynamicJWKSProvider(t *testing.T) {
jwks = newKeySet(t, pub)

tlsPool = internal.NewTLSConfigPool(context.Background())
newCache = func(t *testing.T, oidc *oidcv1.OIDCConfig) JWKSProvider {
newCache = func(_ *testing.T, oidc *oidcv1.OIDCConfig) JWKSProvider {
cfg := &configv1.Config{
Chains: []*configv1.FilterChain{
{
Expand Down
2 changes: 1 addition & 1 deletion internal/server/requestid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestPropagateRequestId(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.Background()
_, _ = PropagateRequestID(ctx, tt.req, nil, func(ctx context.Context, req interface{}) (interface{}, error) {
_, _ = PropagateRequestID(ctx, tt.req, nil, func(ctx context.Context, _ interface{}) (interface{}, error) {
kvs := telemetry.KeyValuesFromContext(ctx)
require.Equal(t, tt.want, kvs)
return nil, nil
Expand Down

0 comments on commit 9c742e8

Please sign in to comment.