use slices package and remove some helpers (#17342)

This commit is contained in:
Harshavardhana
2023-06-06 10:12:52 -07:00
committed by GitHub
parent 5a21b1f353
commit d1448adbda
8 changed files with 42 additions and 50 deletions

View File

@@ -32,7 +32,6 @@ import (
"os"
"path"
"path/filepath"
"reflect"
"runtime"
"runtime/pprof"
"runtime/trace"
@@ -278,18 +277,6 @@ func isMaxPartID(partID int) bool {
return partID > globalMaxPartID
}
func contains(slice interface{}, elem interface{}) bool {
v := reflect.ValueOf(slice)
if v.Kind() == reflect.Slice {
for i := 0; i < v.Len(); i++ {
if v.Index(i).Interface() == elem {
return true
}
}
}
return false
}
// profilerWrapper is created becauses pkg/profiler doesn't
// provide any API to calculate the profiler file path in the
// disk since the name of this latter is randomly generated.