Use fmt.Errorf instead of string concat in schema.go (#16404)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/16341/head
congqixia 2022-04-11 09:47:37 +08:00 committed by GitHub
parent fa697d0d48
commit 994bb829d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -143,10 +143,10 @@ func CreateSchemaHelper(schema *schemapb.CollectionSchema) (*SchemaHelper, error
schemaHelper := SchemaHelper{schema: schema, nameOffset: make(map[string]int), idOffset: make(map[int64]int), primaryKeyOffset: -1}
for offset, field := range schema.Fields {
if _, ok := schemaHelper.nameOffset[field.Name]; ok {
return nil, errors.New("duplicated fieldName: " + field.Name)
return nil, fmt.Errorf("duplicated fieldName: %s", field.Name)
}
if _, ok := schemaHelper.idOffset[field.FieldID]; ok {
return nil, errors.New("duplicated fieldID: " + strconv.FormatInt(field.FieldID, 10))
return nil, fmt.Errorf("duplicated fieldID: %d", field.FieldID)
}
schemaHelper.nameOffset[field.Name] = offset
schemaHelper.idOffset[field.FieldID] = offset