Skip to content

Commit

Permalink
Fix golint error in proxy (#10620)
Browse files Browse the repository at this point in the history
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
  • Loading branch information
czs007 authored Oct 26, 2021
1 parent 1478b92 commit bb08df2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ func (cct *createCollectionTask) PreExecute(ctx context.Context) error {
return err
}

if err := ValidateDuplicatedFieldName(cct.schema.Fields); err != nil {
if err := validateDuplicatedFieldName(cct.schema.Fields); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ func TestCreateCollectionTask(t *testing.T) {
err = task.PreExecute(ctx)
assert.Error(t, err)

// ValidateDuplicatedFieldName
// validateDuplicatedFieldName
schema = proto.Clone(schemaBackup).(*schemapb.CollectionSchema)
schema.Fields = append(schema.Fields, schema.Fields[0])
duplicatedFieldsSchema, err := proto.Marshal(schema)
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/validate_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func validateVectorFieldMetricType(field *schemapb.FieldSchema) error {
return errors.New("vector float without metric_type")
}

func ValidateDuplicatedFieldName(fields []*schemapb.FieldSchema) error {
func validateDuplicatedFieldName(fields []*schemapb.FieldSchema) error {
names := make(map[string]bool)
for _, field := range fields {
_, ok := names[field.Name]
Expand Down
4 changes: 2 additions & 2 deletions internal/proxy/validate_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ func TestValidateDuplicatedFieldName(t *testing.T) {
{Name: "abc"},
{Name: "def"},
}
assert.Nil(t, ValidateDuplicatedFieldName(fields))
assert.Nil(t, validateDuplicatedFieldName(fields))
fields = append(fields, &schemapb.FieldSchema{
Name: "abc",
})
assert.NotNil(t, ValidateDuplicatedFieldName(fields))
assert.NotNil(t, validateDuplicatedFieldName(fields))
}

func TestValidatePrimaryKey(t *testing.T) {
Expand Down

0 comments on commit bb08df2

Please sign in to comment.