mirror of
https://github.com/json-iterator/go.git
synced 2025-02-01 19:14:29 +02:00
Unnamed struct literals
This commit is contained in:
parent
03217c3e97
commit
83f7b825b3
@ -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{}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user