summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/encoder/encoder.go')
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/encoder.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
index 4cba1a168..9e675a536 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
@@ -28,6 +28,7 @@ import (
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
+ "github.com/bytedance/gopkg/lang/dirtmake"
)
// Options is a set of encoding options.
@@ -193,7 +194,7 @@ func Encode(val interface{}, opts Options) ([]byte, error) {
/* make a copy of the result */
if rt.CanSizeResue(cap(*buf)) {
- ret = make([]byte, len(*buf))
+ ret = dirtmake.Bytes(len(*buf), len(*buf))
copy(ret, *buf)
vars.FreeBytes(buf)
} else {