mirror of https://github.com/goccy/go-json.git
Fix indent num for OpMarshalJSON
This commit is contained in:
parent
015b9c40be
commit
29c30bdd14
|
@ -468,7 +468,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte
|
|||
if err := Indent(
|
||||
&indentBuf,
|
||||
compactBuf.Bytes(),
|
||||
string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), ctx.BaseIndent+indent+1),
|
||||
string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), ctx.BaseIndent+indent),
|
||||
string(ctx.IndentStr),
|
||||
); err != nil {
|
||||
return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
|
||||
|
|
|
@ -2853,7 +2853,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2899,7 +2899,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2946,7 +2946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent+1)
|
||||
b = append(b, code.EscapedKey...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2988,7 +2988,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3030,7 +3030,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent+1)
|
||||
b = append(b, code.EscapedKey...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3877,7 +3877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3898,7 +3898,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent)
|
||||
b = append(b, code.EscapedKey...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3913,7 +3913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3928,7 +3928,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent)
|
||||
b = append(b, code.EscapedKey...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, true)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2859,7 +2859,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2905,7 +2905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2952,7 +2952,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent+1)
|
||||
b = append(b, code.Key...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2994,7 +2994,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3036,7 +3036,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent+1)
|
||||
b = append(b, code.Key...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3883,7 +3883,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 && code.Nilcheck {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3904,7 +3904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent)
|
||||
b = append(b, code.Key...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3919,7 +3919,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
if p == 0 {
|
||||
b = appendNull(b)
|
||||
} else {
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -3934,7 +3934,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
|||
b = appendIndent(ctx, b, code.Indent)
|
||||
b = append(b, code.Key...)
|
||||
b = append(b, ' ')
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent, false)
|
||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue