mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
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:
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user