mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
buf resize impl
This commit is contained in:
parent
a664e4c898
commit
fc158b92e1
@ -110,6 +110,10 @@ func (r *Resource) MarshalJSON() ([]byte, error) {
|
|||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
|
|
||||||
|
if cap := b.Cap(); cap < (len(dataRoot) + len(dataChild)) {
|
||||||
|
b.Grow((len(dataRoot) + len(dataChild)) - cap)
|
||||||
|
}
|
||||||
|
|
||||||
b.Write(dataRoot[:len(dataRoot)-1])
|
b.Write(dataRoot[:len(dataRoot)-1])
|
||||||
|
|
||||||
if len(dataChild) != 2 {
|
if len(dataChild) != 2 {
|
||||||
|
Loading…
Reference in New Issue
Block a user