Bump golangci-lint to 1.51.2 and fix lint issues

This commit is contained in:
Joshua Casey
2023-03-16 13:13:49 -05:00
parent a783a5d6b2
commit fc0f9d959a
10 changed files with 24 additions and 20 deletions

View File

@@ -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)

View File

@@ -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
}

View File

@@ -5,6 +5,6 @@
package tlsassertions
func GetTlsErrorPrefix() string {
func GetTLSErrorPrefix() string {
return "tls: failed to verify certificate: "
}

View File

@@ -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())
}