Parcourir la source

#91 fix embedded and ,

Tao Wen il y a 8 ans
Parent
commit
ea8fa7cc63
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      feature_reflect_extension.go

+ 1 - 1
feature_reflect_extension.go

@@ -200,7 +200,7 @@ func describeStruct(cfg *frozenConfig, typ reflect.Type) (*StructDescriptor, err
 	bindings := []*Binding{}
 	for i := 0; i < typ.NumField(); i++ {
 		field := typ.Field(i)
-		if field.Anonymous && field.Tag.Get("json") == "" {
+		if field.Anonymous && (field.Tag.Get("json") == "" || strings.Split(field.Tag.Get("json"), ",")[0] == "") {
 			if field.Type.Kind() == reflect.Struct {
 				structDescriptor, err := describeStruct(cfg, field.Type)
 				if err != nil {