1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-02-07 13:31:50 +02:00

binding: ignore unexpected field (#879)

This commit is contained in:
Cluas 2021-04-28 18:58:40 +08:00 committed by GitHub
parent f33bd70d75
commit 8b875e43a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ import (
"encoding/base64"
"errors"
"fmt"
"log"
"strconv"
"strings"
"time"
@ -51,7 +50,7 @@ func populateFieldValues(v protoreflect.Message, fieldPath []string, values []st
if fd = fields.ByName(protoreflect.Name(fieldName)); fd == nil {
fd = fields.ByJSONName(fieldName)
if fd == nil {
log.Printf("field not found in %q: %q\n", v.Descriptor().FullName(), strings.Join(fieldPath, "."))
// ignore unexpected field.
return nil
}
}