From 54d530784df22e530a1354778049b6e18648cfee Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Mon, 22 Dec 2025 11:03:46 -0800 Subject: [PATCH] upgrade to golangci-lint v2.7.2, bring back some nolint directives --- hack/lib/lint-version.txt | 2 +- .../supervisorconfig/oidcclientwatcher/oidc_client_watcher.go | 1 + internal/endpointaddr/endpointaddr.go | 2 +- internal/plog/config.go | 2 +- internal/plog/level.go | 3 ++- internal/testutil/totp/totp.go | 2 +- test/integration/limited_ciphers_utils_test.go | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hack/lib/lint-version.txt b/hack/lib/lint-version.txt index 860487ca1..37c2961c2 100644 --- a/hack/lib/lint-version.txt +++ b/hack/lib/lint-version.txt @@ -1 +1 @@ -2.7.1 +2.7.2 diff --git a/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher.go b/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher.go index 8662ec965..acd4aa260 100644 --- a/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher.go +++ b/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher.go @@ -146,6 +146,7 @@ func (c *oidcClientWatcherController) updateStatus( updated.Status.Phase = supervisorconfigv1alpha1.OIDCClientPhaseError } + //nolint:gosec // looks like we are willing to accept the risk that there are less than 2147483647 dynamic clients updated.Status.TotalClientSecrets = int32(totalClientSecrets) if equality.Semantic.DeepEqual(upstream, updated) { diff --git a/internal/endpointaddr/endpointaddr.go b/internal/endpointaddr/endpointaddr.go index 08b68c6da..b22dd849a 100644 --- a/internal/endpointaddr/endpointaddr.go +++ b/internal/endpointaddr/endpointaddr.go @@ -73,7 +73,7 @@ func Parse(endpoint string, defaultPort uint16) (HostPort, error) { return HostPort{ Host: host, - Port: uint16(integerPort), // this cast is checked by validation.IsValidPortNum above + Port: uint16(integerPort), //nolint:gosec // this cast is checked by validation.IsValidPortNum above }, nil } diff --git a/internal/plog/config.go b/internal/plog/config.go index 95de96180..b8ce5a00a 100644 --- a/internal/plog/config.go +++ b/internal/plog/config.go @@ -58,7 +58,7 @@ func ValidateAndSetLogLevelAndFormatGlobally(ctx context.Context, spec LogSpec) panic(err) // programmer error } // the range for klogLevel is [0,108] - globalLevel.SetLevel(zapcore.Level(-klogLevel)) // klog levels are inverted when zap handles them + globalLevel.SetLevel(zapcore.Level(-klogLevel)) //nolint:gosec // klog levels are inverted when zap handles them var encoding string switch spec.Format { diff --git a/internal/plog/level.go b/internal/plog/level.go index 55c4641a5..46ad691a8 100644 --- a/internal/plog/level.go +++ b/internal/plog/level.go @@ -44,7 +44,8 @@ const ( func Enabled(level LogLevel) bool { l := klogLevelForPlogLevel(level) // check that both our global level and the klog global level agree that the plog level is enabled - // klog levels are inverted when zap handles them. The range for klogLevel is [0,108]. + // klog levels are inverted when zap handles them. + //nolint:gosec // the range for klogLevel is [0,108] return globalLevel.Enabled(zapcore.Level(-l)) && klog.V(l).Enabled() } diff --git a/internal/testutil/totp/totp.go b/internal/testutil/totp/totp.go index bb01bd6ea..30d1248b2 100644 --- a/internal/testutil/totp/totp.go +++ b/internal/testutil/totp/totp.go @@ -80,7 +80,7 @@ func GenerateOTPCode(t *testing.T, token string, when time.Time) (string, int64) ((int(sum[offset+2] & mask3)) << shift8) | (int(sum[offset+3]) & mask3)) - modulo := int32(value % int64(math.Pow10(length))) // the resulting number must be less than 10^6 + modulo := int32(value % int64(math.Pow10(length))) //nolint:gosec // the resulting number must be less than 10^6 format := fmt.Sprintf("%%0%dd", length) diff --git a/test/integration/limited_ciphers_utils_test.go b/test/integration/limited_ciphers_utils_test.go index ec07bcf1e..3b6682bcb 100644 --- a/test/integration/limited_ciphers_utils_test.go +++ b/test/integration/limited_ciphers_utils_test.go @@ -115,7 +115,7 @@ func expectTLSConfigForServicePort( ) { portAsInt, err := strconv.Atoi(localPortAsStr) require.NoError(t, err) - portAsUint := uint16(portAsInt) // okay to cast because it will only be legal port numbers + portAsUint := uint16(portAsInt) //nolint:gosec // okay to cast because it will only be legal port numbers startKubectlPortForward(ctx, t, localPortAsStr, "443", serviceName, serviceNamespace)