From 1ba732a07d026dffef5e297fbc52db8ba8bd1375 Mon Sep 17 00:00:00 2001 From: onelrdm Date: Sat, 28 Sep 2019 17:17:44 +0800 Subject: [PATCH] skip - tag before spliting parts --- reflect_extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflect_extension.go b/reflect_extension.go index 05e8fbf..e27e8d1 100644 --- a/reflect_extension.go +++ b/reflect_extension.go @@ -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())