You've already forked json-iterator
							
							
				mirror of
				https://github.com/json-iterator/go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Merge pull request #416 from jarredhawkins/issue-415
Ignore unnamed literals in structs
This commit is contained in:
		| @@ -341,7 +341,7 @@ func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { | ||||
| 		if ctx.onlyTaggedField && !hastag && !field.Anonymous() { | ||||
| 			continue | ||||
| 		} | ||||
| 		if tag == "-" { | ||||
| 		if tag == "-" || field.Name() == "_" { | ||||
| 			continue | ||||
| 		} | ||||
| 		tagParts := strings.Split(tag, ",") | ||||
|   | ||||
| @@ -60,6 +60,7 @@ func init() { | ||||
| 		(*SameLevel2NoTags)(nil), | ||||
| 		(*SameLevel2Tagged)(nil), | ||||
| 		(*EmbeddedPtr)(nil), | ||||
| 		(*UnnamedLiteral)(nil), | ||||
| 	) | ||||
| } | ||||
|  | ||||
| @@ -231,3 +232,7 @@ type EmbeddedPtrOption struct { | ||||
| type EmbeddedPtr struct { | ||||
| 	EmbeddedPtrOption `json:","` | ||||
| } | ||||
|  | ||||
| type UnnamedLiteral struct { | ||||
| 	_ struct{} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user