Skip to content

Commit

Permalink
Merge pull request #5688 from emirot/refactor/indexOf
Browse files Browse the repository at this point in the history
refactor: function in stdlib now
  • Loading branch information
k8s-ci-robot authored May 6, 2024
2 parents 49a645f + f983846 commit e244b83
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions kustomize/commands/edit/fix/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

0 comments on commit e244b83

Please sign in to comment.