Clarify that value arg to field.TooLong is unused

This commit is contained in:
Tim Hockin
2024-11-04 15:44:40 -08:00
parent 4d0e1c8fd4
commit 8a7af90300
14 changed files with 34 additions and 38 deletions

View File

@@ -1685,7 +1685,7 @@ func ValidateCSIDriverName(driverName string, fldPath *field.Path) field.ErrorLi
}
if len(driverName) > 63 {
allErrs = append(allErrs, field.TooLong(fldPath, driverName, 63))
allErrs = append(allErrs, field.TooLong(fldPath, "", 63))
}
for _, msg := range validation.IsDNS1123Subdomain(strings.ToLower(driverName)) {
@@ -4758,7 +4758,7 @@ func ValidateAppArmorProfileField(profile *core.AppArmorProfile, fldPath *field.
const maxLocalhostProfileLength = 4095 // PATH_MAX - 1
if len(*profile.LocalhostProfile) > maxLocalhostProfileLength {
allErrs = append(allErrs, field.TooLong(fldPath.Child("localhostProfile"), *profile.LocalhostProfile, maxLocalhostProfileLength))
allErrs = append(allErrs, field.TooLong(fldPath.Child("localhostProfile"), "", maxLocalhostProfileLength))
}
}
@@ -6661,7 +6661,7 @@ func ValidateConfigMap(cfg *core.ConfigMap) field.ErrorList {
}
if totalSize > core.MaxSecretSize {
// pass back "" to indicate that the error refers to the whole object.
allErrs = append(allErrs, field.TooLong(field.NewPath(""), cfg, core.MaxSecretSize))
allErrs = append(allErrs, field.TooLong(field.NewPath(""), "", core.MaxSecretSize))
}
return allErrs