mirror of https://github.com/goccy/go-json.git
Fix forgot to add key in omitempty field
This commit is contained in:
parent
fa4d5842e6
commit
f8b2b03584
|
@ -7936,7 +7936,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
if p == 0 || uintptr(array.data) == 0 {
|
if p == 0 || uintptr(array.data) == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.key...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
case opStructFieldSlice:
|
case opStructFieldSlice:
|
||||||
b = append(b, code.key...)
|
b = append(b, code.key...)
|
||||||
|
@ -7951,7 +7953,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
if p == 0 || uintptr(slice.data) == 0 {
|
if p == 0 || uintptr(slice.data) == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.key...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
case opStructFieldMap:
|
case opStructFieldMap:
|
||||||
b = append(b, code.key...)
|
b = append(b, code.key...)
|
||||||
|
@ -7969,7 +7973,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
if mlen == 0 {
|
if mlen == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.key...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case opStructFieldMapLoad:
|
case opStructFieldMapLoad:
|
||||||
|
@ -7988,7 +7994,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
if mlen == 0 {
|
if mlen == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.key...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case opStructFieldStruct:
|
case opStructFieldStruct:
|
||||||
|
|
|
@ -7922,7 +7922,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
||||||
if p == 0 || uintptr(array.data) == 0 {
|
if p == 0 || uintptr(array.data) == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.escapedKey...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
case opStructFieldSlice:
|
case opStructFieldSlice:
|
||||||
b = append(b, code.escapedKey...)
|
b = append(b, code.escapedKey...)
|
||||||
|
@ -7937,7 +7939,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
||||||
if p == 0 || uintptr(slice.data) == 0 {
|
if p == 0 || uintptr(slice.data) == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.escapedKey...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
case opStructFieldMap:
|
case opStructFieldMap:
|
||||||
b = append(b, code.escapedKey...)
|
b = append(b, code.escapedKey...)
|
||||||
|
@ -7955,7 +7959,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
||||||
if mlen == 0 {
|
if mlen == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.escapedKey...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case opStructFieldMapLoad:
|
case opStructFieldMapLoad:
|
||||||
|
@ -7974,7 +7980,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
|
||||||
if mlen == 0 {
|
if mlen == 0 {
|
||||||
code = code.nextField
|
code = code.nextField
|
||||||
} else {
|
} else {
|
||||||
|
b = append(b, code.escapedKey...)
|
||||||
code = code.next
|
code = code.next
|
||||||
|
store(ctxptr, code.idx, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case opStructFieldStruct:
|
case opStructFieldStruct:
|
||||||
|
|
Loading…
Reference in New Issue