mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-07 22:15:40 +00:00
upgrade linter and fix new lint errors
This commit is contained in:
@@ -745,7 +745,6 @@ func validateKubeconfig(ctx context.Context, flags getKubeconfigParams, kubeconf
|
||||
func countCACerts(pemData []byte) int {
|
||||
pool := x509.NewCertPool()
|
||||
pool.AppendCertsFromPEM(pemData)
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return len(pool.Subjects())
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.59.1
|
||||
1.60.1
|
||||
|
||||
@@ -209,7 +209,6 @@ func TestPool(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
pool := ca.Pool()
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
require.Len(t, pool.Subjects(), 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) {
|
||||
cert, err := tls.X509KeyPair(certPEM, keyPEM)
|
||||
require.NoError(t, err)
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return pool.Subjects(), []tls.Certificate{cert}
|
||||
},
|
||||
},
|
||||
@@ -71,7 +70,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) {
|
||||
|
||||
certKey.UnsetCertKeyContent()
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return pool.Subjects(), []tls.Certificate{cert}
|
||||
},
|
||||
},
|
||||
@@ -90,7 +88,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) {
|
||||
cert, err := tls.X509KeyPair(certPEM, keyPEM)
|
||||
require.NoError(t, err)
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return newCA.Pool().Subjects(), []tls.Certificate{cert}
|
||||
},
|
||||
},
|
||||
@@ -114,7 +111,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) {
|
||||
ok := pool.AppendCertsFromPEM(ca.CurrentCABundleContent())
|
||||
require.True(t, ok, "should have valid non-empty CA bundle")
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return pool.Subjects(), []tls.Certificate{cert}
|
||||
},
|
||||
},
|
||||
@@ -142,7 +138,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) {
|
||||
err = ca.SetCertKeyContent(newOtherCA.Bundle(), caKey)
|
||||
require.NoError(t, err)
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return newOtherCA.Pool().Subjects(), []tls.Certificate{cert}
|
||||
},
|
||||
},
|
||||
@@ -226,7 +221,6 @@ func poolSubjects(pool *x509.CertPool) [][]byte {
|
||||
if pool == nil {
|
||||
return nil
|
||||
}
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
return pool.Subjects()
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ type errSerializationFailureWithCause struct {
|
||||
}
|
||||
|
||||
func (e *errSerializationFailureWithCause) Is(err error) bool {
|
||||
return stderrors.Is(fosite.ErrSerializationFailure, err)
|
||||
return stderrors.Is(err, fosite.ErrSerializationFailure)
|
||||
}
|
||||
|
||||
func (e *errSerializationFailureWithCause) Unwrap() error {
|
||||
|
||||
@@ -949,7 +949,6 @@ func TestUnwrap(t *testing.T) {
|
||||
|
||||
server, restConfig := fakekubeapi.Start(t, nil)
|
||||
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
serverSubjects := server.Client().Transport.(*http.Transport).TLSClientConfig.RootCAs.Subjects()
|
||||
|
||||
t.Run("regular client", func(t *testing.T) {
|
||||
@@ -1148,7 +1147,6 @@ func testUnwrap(t *testing.T, client *Client, serverSubjects [][]byte, tlsConfig
|
||||
require.Equal(t, ptlsConfig.NextProtos, tlsConfig.NextProtos)
|
||||
|
||||
// x509.CertPool has some embedded functions that make it hard to compare so just look at the subjects
|
||||
//nolint:staticcheck // since we're not using .Subjects() to access the system pool
|
||||
require.Equal(t, serverSubjects, tlsConfig.RootCAs.Subjects())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package clientsecretrequest
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"slices"
|
||||
@@ -241,7 +242,7 @@ func (r *REST) validateRequest(
|
||||
if !ok {
|
||||
msg := "no namespace information found in request context"
|
||||
traceValidationFailure(tracer, msg)
|
||||
return nil, apierrors.NewInternalError(fmt.Errorf(msg))
|
||||
return nil, apierrors.NewInternalError(errors.New(msg))
|
||||
}
|
||||
if err := rest.EnsureObjectNamespaceMatchesRequestNamespace(requestNamespace, clientSecretRequest); err != nil {
|
||||
traceValidationFailure(tracer, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user