upgrade to golangci-lint v2.7.2, bring back some nolint directives

This commit is contained in:
Ryan Richard
2025-12-22 11:03:46 -08:00
parent 44509d016e
commit 54d530784d
7 changed files with 8 additions and 6 deletions

View File

@@ -1 +1 @@
2.7.1 2.7.2

View File

@@ -146,6 +146,7 @@ func (c *oidcClientWatcherController) updateStatus(
updated.Status.Phase = supervisorconfigv1alpha1.OIDCClientPhaseError 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) updated.Status.TotalClientSecrets = int32(totalClientSecrets)
if equality.Semantic.DeepEqual(upstream, updated) { if equality.Semantic.DeepEqual(upstream, updated) {

View File

@@ -73,7 +73,7 @@ func Parse(endpoint string, defaultPort uint16) (HostPort, error) {
return HostPort{ return HostPort{
Host: host, 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 }, nil
} }

View File

@@ -58,7 +58,7 @@ func ValidateAndSetLogLevelAndFormatGlobally(ctx context.Context, spec LogSpec)
panic(err) // programmer error panic(err) // programmer error
} }
// the range for klogLevel is [0,108] // 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 var encoding string
switch spec.Format { switch spec.Format {

View File

@@ -44,7 +44,8 @@ const (
func Enabled(level LogLevel) bool { func Enabled(level LogLevel) bool {
l := klogLevelForPlogLevel(level) l := klogLevelForPlogLevel(level)
// check that both our global level and the klog global level agree that the plog level is enabled // 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() return globalLevel.Enabled(zapcore.Level(-l)) && klog.V(l).Enabled()
} }

View File

@@ -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+2] & mask3)) << shift8) |
(int(sum[offset+3]) & mask3)) (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) format := fmt.Sprintf("%%0%dd", length)

View File

@@ -115,7 +115,7 @@ func expectTLSConfigForServicePort(
) { ) {
portAsInt, err := strconv.Atoi(localPortAsStr) portAsInt, err := strconv.Atoi(localPortAsStr)
require.NoError(t, err) 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) startKubectlPortForward(ctx, t, localPortAsStr, "443", serviceName, serviceNamespace)