Skip to content

Commit 390a54f

Browse files
authored
Merge pull request kubernetes#88484 from steveazz/steveazz/68026-validaton
Fix golint issues for `core/v1/validation`
2 parents 74c0fca + 4eb0657 commit 390a54f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pkg/apis/core/helper/qos
2727
pkg/apis/core/v1
2828
pkg/apis/core/v1/helper
2929
pkg/apis/core/v1/helper/qos
30-
pkg/apis/core/v1/validation
3130
pkg/apis/core/validation
3231
pkg/apis/discovery/v1alpha1
3332
pkg/apis/discovery/v1beta1

pkg/apis/core/v1/validation/validation.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ import (
3232
const isNegativeErrorMsg string = `must be greater than or equal to 0`
3333
const isNotIntegerErrorMsg string = `must be an integer`
3434

35+
// ValidateResourceRequirements will check if any of the resource
36+
// Limits/Requests are of a valid value. Any incorrect value will be added to
37+
// the ErrorList.
3538
func ValidateResourceRequirements(requirements *v1.ResourceRequirements, fldPath *field.Path) field.ErrorList {
3639
allErrs := field.ErrorList{}
3740
limPath := fldPath.Child("limits")
@@ -93,7 +96,7 @@ func ValidateResourceQuantityValue(resource string, value resource.Quantity, fld
9396
return allErrs
9497
}
9598

96-
// Validates that a Quantity is not negative
99+
// ValidateNonnegativeQuantity checks that a Quantity is not negative.
97100
func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
98101
allErrs := field.ErrorList{}
99102
if value.Cmp(resource.Quantity{}) < 0 {
@@ -122,6 +125,8 @@ func validateResourceName(value string, fldPath *field.Path) field.ErrorList {
122125
return allErrs
123126
}
124127

128+
// ValidatePodLogOptions checks if options that are set are at the correct
129+
// value. Any incorrect value will be returned to the ErrorList.
125130
func ValidatePodLogOptions(opts *v1.PodLogOptions) field.ErrorList {
126131
allErrs := field.ErrorList{}
127132
if opts.TailLines != nil && *opts.TailLines < 0 {
@@ -141,6 +146,8 @@ func ValidatePodLogOptions(opts *v1.PodLogOptions) field.ErrorList {
141146
return allErrs
142147
}
143148

149+
// AccumulateUniqueHostPorts checks all the containers for duplicates ports. Any
150+
// duplicate port will be returned in the ErrorList.
144151
func AccumulateUniqueHostPorts(containers []v1.Container, accumulator *sets.String, fldPath *field.Path) field.ErrorList {
145152
allErrs := field.ErrorList{}
146153

0 commit comments

Comments
 (0)