change variable name and remove else stmt
@@ -1073,8 +1073,8 @@ func ValidateVirtualMachineInstanceSpec(field *k8sfield.Path, spec *v1.VirtualMa
})
return causes
}
- for _, index := range PrivateOptions {
- if !(index.Option >= 224 && index.Option <= 254) {
+ for _, DHCPPrivateOption := range PrivateOptions {
+ if !(DHCPPrivateOption.Option >= 224 && DHCPPrivateOption.Option <= 254) {
causes = append(causes, metav1.StatusCause{
Type: metav1.CauseTypeFieldValueInvalid,
Message: "provided DHCPPrivateOptions are out of range, must be in range 224 to 254",
@@ -1636,12 +1636,11 @@ func ServeMigrationUpdate(resp http.ResponseWriter, req *http.Request) {
func ValidateDuplicateDHCPPrivateOptions(PrivateOptions []v1.DHCPPrivateOptions) error {
isUnique := map[int]bool{}
- for _, index := range PrivateOptions {
- if isUnique[index.Option] == true {
+ for _, DHCPPrivateOption := range PrivateOptions {
+ if isUnique[DHCPPrivateOption.Option] == true {
return fmt.Errorf("You have provided duplicate DHCPPrivateOptions")
- } else {
- isUnique[index.Option] = true
}
+ isUnique[DHCPPrivateOption.Option] = true
}
return nil
}
