cleanup: use slices package

This commit replaces the user implemented function
`CheckSliceContains()` with `slices.Contains()`
function introduced in Go 1.21.

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M
2024-04-01 09:02:41 +05:30
committed by mergify[bot]
parent 86a89d5425
commit c1467242c6
2 changed files with 3 additions and 13 deletions

View File

@ -383,17 +383,6 @@ func CallStack() string {
return string(stack)
}
// CheckSliceContains checks the slice for string.
func CheckSliceContains(options []string, opt string) bool {
for _, o := range options {
if o == opt {
return true
}
}
return false
}
// GetVolumeContext filters out parameters that are not required in volume context.
func GetVolumeContext(parameters map[string]string) map[string]string {
volumeContext := map[string]string{}
@ -403,7 +392,7 @@ func GetVolumeContext(parameters map[string]string) map[string]string {
topologyPoolsParam,
}
for k, v := range parameters {
if !CheckSliceContains(notRequiredParams, k) {
if !slices.Contains(notRequiredParams, k) {
volumeContext[k] = v
}
}