mirror of https://github.com/milvus-io/milvus.git
[skip ci]Fix golint warnings in funcutil (#9235)
Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>pull/9241/head
parent
a5daaf0755
commit
7e611e8799
|
@ -102,12 +102,12 @@ func WaitForComponentInitOrHealthy(ctx context.Context, service types.Component,
|
|||
return WaitForComponentStates(ctx, service, serviceName, []internalpb.StateCode{internalpb.StateCode_Initializing, internalpb.StateCode_Healthy}, attempts, sleep)
|
||||
}
|
||||
|
||||
// WaitForComponentInitOrHealthy wait for component's state to be initializing
|
||||
// WaitForComponentInit wait for component's state to be initializing
|
||||
func WaitForComponentInit(ctx context.Context, service types.Component, serviceName string, attempts uint, sleep time.Duration) error {
|
||||
return WaitForComponentStates(ctx, service, serviceName, []internalpb.StateCode{internalpb.StateCode_Initializing}, attempts, sleep)
|
||||
}
|
||||
|
||||
// WaitForComponentInitOrHealthy wait for component's state to be healthy
|
||||
// WaitForComponentHealthy wait for component's state to be healthy
|
||||
func WaitForComponentHealthy(ctx context.Context, service types.Component, serviceName string, attempts uint, sleep time.Duration) error {
|
||||
return WaitForComponentStates(ctx, service, serviceName, []internalpb.StateCode{internalpb.StateCode_Healthy}, attempts, sleep)
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ func ParseIndexParamsMap(mStr string) (map[string]string, error) {
|
|||
}
|
||||
|
||||
const (
|
||||
// PulsarMaxMessageSizeKey is the key of config item
|
||||
PulsarMaxMessageSizeKey = "maxMessageSize"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,12 +20,13 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// GetFunctionName returns the name of input
|
||||
func GetFunctionName(i interface{}) string {
|
||||
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
|
||||
}
|
||||
|
||||
// Reference: https://stackoverflow.com/questions/40809504/idiomatic-goroutine-termination-and-error-handling
|
||||
// ProcessFuncParallel process function in parallel.
|
||||
// Reference: https://stackoverflow.com/questions/40809504/idiomatic-goroutine-termination-and-error-handling
|
||||
func ProcessFuncParallel(total, maxParallel int, f func(idx int) error, fname string) error {
|
||||
if maxParallel <= 0 {
|
||||
maxParallel = 1
|
||||
|
|
|
@ -17,18 +17,19 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var Rand *rand.Rand = nil
|
||||
var r *rand.Rand = nil
|
||||
|
||||
func init() {
|
||||
Rand = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
r = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
}
|
||||
|
||||
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
// RandomString returns a batch of random string
|
||||
func RandomString(n int) string {
|
||||
b := make([]rune, n)
|
||||
for i := range b {
|
||||
b[i] = letterRunes[Rand.Intn(len(letterRunes))]
|
||||
b[i] = letterRunes[r.Intn(len(letterRunes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ func SliceContain(s interface{}, item interface{}) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// SliceSetEqual is used to compare two Slice
|
||||
func SliceSetEqual(s1 interface{}, s2 interface{}) bool {
|
||||
ss1 := reflect.ValueOf(s1)
|
||||
ss2 := reflect.ValueOf(s2)
|
||||
|
@ -49,6 +50,7 @@ func SliceSetEqual(s1 interface{}, s2 interface{}) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// SortedSliceEqual is used to compare two Sorted Slice
|
||||
func SortedSliceEqual(s1 interface{}, s2 interface{}) bool {
|
||||
ss1 := reflect.ValueOf(s1)
|
||||
ss2 := reflect.ValueOf(s2)
|
||||
|
|
Loading…
Reference in New Issue