From f9838461af428596f8b789c86f9ae1cb65f52a6b Mon Sep 17 00:00:00 2001 From: emirot Date: Fri, 3 May 2024 22:45:56 +0200 Subject: [PATCH] refactor: function in stdlib now Signed-off-by: emirot --- kustomize/commands/edit/fix/convert.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/kustomize/commands/edit/fix/convert.go b/kustomize/commands/edit/fix/convert.go index 8585392a46..04162d7c17 100644 --- a/kustomize/commands/edit/fix/convert.go +++ b/kustomize/commands/edit/fix/convert.go @@ -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 -}