Update with static check suggestions

This commit is contained in:
Matt Long 2020-05-27 15:51:55 +02:00
parent 1fea54bc3c
commit 2317b77ba5
1 changed files with 2 additions and 2 deletions

View File

@ -642,7 +642,7 @@ func validateCalicoAutoDetectionMethod(fldPath *field.Path, runtime *string, ver
} else if strings.HasPrefix(*runtime, methodInterface) { } else if strings.HasPrefix(*runtime, methodInterface) {
ifStr := strings.TrimPrefix(*runtime, methodInterface) ifStr := strings.TrimPrefix(*runtime, methodInterface)
ifRegexes := regexp.MustCompile("\\s*,\\s*").Split(ifStr, -1) ifRegexes := regexp.MustCompile(`\s*,\s*`).Split(ifStr, -1)
if len(ifRegexes) == 0 || ifRegexes[0] == "" { if len(ifRegexes) == 0 || ifRegexes[0] == "" {
validationError = append(validationError, field.Invalid(fldPath, runtime, "Expected 'interface=<COMMA-SEPARATED-LIST>'")) validationError = append(validationError, field.Invalid(fldPath, runtime, "Expected 'interface=<COMMA-SEPARATED-LIST>'"))
} }
@ -656,7 +656,7 @@ func validateCalicoAutoDetectionMethod(fldPath *field.Path, runtime *string, ver
} else if strings.HasPrefix(*runtime, methodSkipInterface) { } else if strings.HasPrefix(*runtime, methodSkipInterface) {
ifStr := strings.TrimPrefix(*runtime, methodSkipInterface) ifStr := strings.TrimPrefix(*runtime, methodSkipInterface)
ifRegexes := regexp.MustCompile("\\s*,\\s*").Split(ifStr, -1) ifRegexes := regexp.MustCompile(`\s*,\s*`).Split(ifStr, -1)
if len(ifRegexes) == 0 || ifRegexes[0] == "" { if len(ifRegexes) == 0 || ifRegexes[0] == "" {
validationError = append(validationError, field.Invalid(fldPath, runtime, "Expected 'skip-interface=<COMMA-SEPARATED-LIST>'")) validationError = append(validationError, field.Invalid(fldPath, runtime, "Expected 'skip-interface=<COMMA-SEPARATED-LIST>'"))
} }