mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
util: use slices package for contains
use slices package to check whether the slice contains the element or not. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
86b5db90bc
commit
1e0254daba
@ -23,6 +23,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -363,7 +364,7 @@ func MountOptionsAdd(options string, add ...string) string {
|
||||
}
|
||||
|
||||
for _, opt := range add {
|
||||
if opt != "" && !contains(newOpts, opt) {
|
||||
if opt != "" && !slices.Contains(newOpts, opt) {
|
||||
newOpts = append(newOpts, opt)
|
||||
}
|
||||
}
|
||||
@ -371,16 +372,6 @@ func MountOptionsAdd(options string, add ...string) string {
|
||||
return strings.Join(newOpts, ",")
|
||||
}
|
||||
|
||||
func contains(s []string, key string) bool {
|
||||
for _, v := range s {
|
||||
if v == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// CallStack returns the stack of the calls in the current goroutine. Useful
|
||||
// for debugging or reporting errors. This is a friendly alternative to
|
||||
// assert() or panic().
|
||||
|
Reference in New Issue
Block a user