Skip to content

Commit e244b83

Browse files
authored
Merge pull request #5688 from emirot/refactor/indexOf
refactor: function in stdlib now
2 parents 49a645f + f983846 commit e244b83

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

kustomize/commands/edit/fix/convert.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func constructFieldOptions(value string, varString string) ([]*types.FieldOption
224224
return nil, fmt.Errorf("cannot convert all vars to replacements; %s is not delimited", varString)
225225
}
226226
delimiter = pre
227-
index = indexOf(varString, strings.Split(value, delimiter))
227+
index = slices.Index(strings.Split(value, delimiter), varString)
228228
if index == -1 {
229229
// this should never happen
230230
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
328328
}
329329
return nil
330330
}
331-
332-
func indexOf(varName string, slice []string) int {
333-
for i := range slice {
334-
if slice[i] == varName {
335-
return i
336-
}
337-
}
338-
return -1
339-
}

0 commit comments

Comments
 (0)