1
0
mirror of https://github.com/json-iterator/go.git synced 2025-04-20 11:28:49 +02:00

Merge pull request #408 from onelrdm/master

skip - tag before spliting parts
This commit is contained in:
Tao Wen 2019-10-12 21:05:04 +08:00 committed by GitHub
commit 908eaed151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,10 +341,10 @@ func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor {
if ctx.onlyTaggedField && !hastag && !field.Anonymous() {
continue
}
tagParts := strings.Split(tag, ",")
if tag == "-" {
continue
}
tagParts := strings.Split(tag, ",")
if field.Anonymous() && (tag == "" || tagParts[0] == "") {
if field.Type().Kind() == reflect.Struct {
structDescriptor := describeStruct(ctx, field.Type())