mirror of https://github.com/milvus-io/milvus.git
Fix golint error in proxy (#10487)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/10517/head
parent
169359448f
commit
51d82fc71d
|
@ -1172,7 +1172,7 @@ func (cct *createCollectionTask) PreExecute(ctx context.Context) error {
|
|||
|
||||
// validate field name
|
||||
for _, field := range cct.schema.Fields {
|
||||
if err := ValidateFieldName(field.Name); err != nil {
|
||||
if err := validateFieldName(field.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
if field.DataType == schemapb.DataType_FloatVector || field.DataType == schemapb.DataType_BinaryVector {
|
||||
|
@ -3547,7 +3547,7 @@ func (cit *createIndexTask) PreExecute(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := ValidateFieldName(fieldName); err != nil {
|
||||
if err := validateFieldName(fieldName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -3738,7 +3738,7 @@ func (dit *dropIndexTask) PreExecute(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := ValidateFieldName(fieldName); err != nil {
|
||||
if err := validateFieldName(fieldName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -1024,7 +1024,7 @@ func TestCreateCollectionTask(t *testing.T) {
|
|||
err = task.PreExecute(ctx)
|
||||
assert.Error(t, err)
|
||||
|
||||
// ValidateFieldName
|
||||
// validateFieldName
|
||||
schema = proto.Clone(schemaBackup).(*schemapb.CollectionSchema)
|
||||
for idx := range schema.Fields {
|
||||
schema.Fields[idx].Name = "$"
|
||||
|
|
|
@ -109,7 +109,7 @@ func validatePartitionTag(partitionTag string, strictCheck bool) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ValidateFieldName(fieldName string) error {
|
||||
func validateFieldName(fieldName string) error {
|
||||
fieldName = strings.TrimSpace(fieldName)
|
||||
|
||||
if fieldName == "" {
|
||||
|
|
|
@ -73,8 +73,8 @@ func TestValidatePartitionTag(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestValidateFieldName(t *testing.T) {
|
||||
assert.Nil(t, ValidateFieldName("abc"))
|
||||
assert.Nil(t, ValidateFieldName("_123abc"))
|
||||
assert.Nil(t, validateFieldName("abc"))
|
||||
assert.Nil(t, validateFieldName("_123abc"))
|
||||
|
||||
longName := make([]byte, 256)
|
||||
for i := 0; i < len(longName); i++ {
|
||||
|
@ -91,7 +91,7 @@ func TestValidateFieldName(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, name := range invalidNames {
|
||||
assert.NotNil(t, ValidateFieldName(name))
|
||||
assert.NotNil(t, validateFieldName(name))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue