diff --git a/internal/rbd/rbd_attach.go b/internal/rbd/rbd_attach.go index ee17a7c7e9f9..fbac9a3f7679 100644 --- a/internal/rbd/rbd_attach.go +++ b/internal/rbd/rbd_attach.go @@ -21,6 +21,7 @@ import ( "encoding/json" "fmt" "os" + "slices" "strings" "time" @@ -363,7 +364,7 @@ func attachRBDImage(ctx context.Context, volOptions *rbdVolume, device string, c } func appendNbdDeviceTypeAndOptions(cmdArgs []string, userOptions, cookie string) []string { - isUnmap := util.CheckSliceContains(cmdArgs, "unmap") + isUnmap := slices.Contains(cmdArgs, "unmap") if !isUnmap { if !strings.Contains(userOptions, useNbdNetlink) { cmdArgs = append(cmdArgs, "--"+useNbdNetlink) diff --git a/internal/util/util.go b/internal/util/util.go index a4c74ae2b262..c7ecf349af13 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -23,6 +23,7 @@ import ( "math" "os" "runtime" + "slices" "strings" "time" @@ -392,17 +393,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{} @@ -412,7 +402,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 } }