From 994bb829d311a4f73fb6b189592e20fed0dfa85b Mon Sep 17 00:00:00 2001 From: congqixia Date: Mon, 11 Apr 2022 09:47:37 +0800 Subject: [PATCH] Use fmt.Errorf instead of string concat in schema.go (#16404) Signed-off-by: Congqi Xia --- internal/util/typeutil/schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/util/typeutil/schema.go b/internal/util/typeutil/schema.go index 0c4cca22c0..9c97ddc629 100644 --- a/internal/util/typeutil/schema.go +++ b/internal/util/typeutil/schema.go @@ -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