mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #5688 from emirot/refactor/indexOf
refactor: function in stdlib now
This commit is contained in:
@@ -224,7 +224,7 @@ func constructFieldOptions(value string, varString string) ([]*types.FieldOption
|
||||
return nil, fmt.Errorf("cannot convert all vars to replacements; %s is not delimited", varString)
|
||||
}
|
||||
delimiter = pre
|
||||
index = indexOf(varString, strings.Split(value, delimiter))
|
||||
index = slices.Index(strings.Split(value, delimiter), varString)
|
||||
if index == -1 {
|
||||
// this should never happen
|
||||
return nil, fmt.Errorf("internal error: could not get index of var %s", varString)
|
||||
@@ -328,12 +328,3 @@ func setPlaceholderValue(varName string, files []string, fSys filesys.FileSystem
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func indexOf(varName string, slice []string) int {
|
||||
for i := range slice {
|
||||
if slice[i] == varName {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user