mirror of
https://github.com/json-iterator/go.git
synced 2025-05-13 21:36: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() {
|
if ctx.onlyTaggedField && !hastag && !field.Anonymous() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if tag == "-" {
|
if tag == "-" || field.Name() == "_" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tagParts := strings.Split(tag, ",")
|
tagParts := strings.Split(tag, ",")
|
||||||
|
@ -60,6 +60,7 @@ func init() {
|
|||||||
(*SameLevel2NoTags)(nil),
|
(*SameLevel2NoTags)(nil),
|
||||||
(*SameLevel2Tagged)(nil),
|
(*SameLevel2Tagged)(nil),
|
||||||
(*EmbeddedPtr)(nil),
|
(*EmbeddedPtr)(nil),
|
||||||
|
(*UnnamedLiteral)(nil),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,3 +232,7 @@ type EmbeddedPtrOption struct {
|
|||||||
type EmbeddedPtr struct {
|
type EmbeddedPtr struct {
|
||||||
EmbeddedPtrOption `json:","`
|
EmbeddedPtrOption `json:","`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UnnamedLiteral struct {
|
||||||
|
_ struct{}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user