mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-08 07:11:53 +00:00
Bump golangci-lint to 1.51.2 and fix lint issues
This commit is contained in:
@@ -12,11 +12,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.pinniped.dev/internal/testutil/tlsassertions"
|
||||
v12 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
|
||||
"go.pinniped.dev/internal/testutil/tlsassertions"
|
||||
)
|
||||
|
||||
func RequireTimeInDelta(t *testing.T, t1 time.Time, t2 time.Time, delta time.Duration) {
|
||||
@@ -180,8 +181,8 @@ func WantX509UntrustedCertErrorString(expectedErrorFormatSpecifier string, expec
|
||||
// This is the normal Go x509 library error string.
|
||||
standardErr := `x509: certificate signed by unknown authority`
|
||||
allowedErrorStrings := []string{
|
||||
fmt.Sprintf(expectedErrorFormatSpecifier, tlsassertions.GetTlsErrorPrefix()+macOSErr),
|
||||
fmt.Sprintf(expectedErrorFormatSpecifier, tlsassertions.GetTlsErrorPrefix()+standardErr),
|
||||
fmt.Sprintf(expectedErrorFormatSpecifier, tlsassertions.GetTLSErrorPrefix()+macOSErr),
|
||||
fmt.Sprintf(expectedErrorFormatSpecifier, tlsassertions.GetTLSErrorPrefix()+standardErr),
|
||||
}
|
||||
// Allow either.
|
||||
require.Contains(t, allowedErrorStrings, actualErrorStr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package testlogger
|
||||
@@ -33,7 +33,7 @@ type logger struct {
|
||||
|
||||
func (l logger) clone() logger {
|
||||
out := l
|
||||
l.values = copySlice(l.values) //nolint:staticcheck // ignore ineffective assignment warning
|
||||
l.values = copySlice(l.values)
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
package tlsassertions
|
||||
|
||||
func GetTlsErrorPrefix() string {
|
||||
func GetTLSErrorPrefix() string {
|
||||
return "tls: failed to verify certificate: "
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetTlsErrorPrefix(t *testing.T) {
|
||||
func TestGetTLSErrorPrefix(t *testing.T) {
|
||||
expected := "tls: failed to verify certificate: "
|
||||
|
||||
if strings.Contains(runtime.Version(), "1.19") {
|
||||
expected = ""
|
||||
}
|
||||
|
||||
require.Equal(t, expected, GetTlsErrorPrefix())
|
||||
require.Equal(t, expected, GetTLSErrorPrefix())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user