From 12e088f9e99eded9e7300a0f9791105bf166018b Mon Sep 17 00:00:00 2001 From: Yi Duan Date: Mon, 6 Sep 2021 16:58:03 +0800 Subject: [PATCH] opt(ast): append string instead of []byte (#88) Co-authored-by: duanyi.aster Co-authored-by: Oxygen --- ast/encode.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ast/encode.go b/ast/encode.go index 38eae51..c5ef602 100644 --- a/ast/encode.go +++ b/ast/encode.go @@ -24,18 +24,12 @@ const ( _MaxBuffer = 4 * 1024 // 4KB buffer size ) -var ( - bytesNull = []byte("null") - bytesTrue = []byte("true") - bytesFalse = []byte("false") - bytesObject = []byte("{}") - bytesArray = []byte("[]") - - lenNull = len("null") - lenTrue = len("true") - lenFalse = len("false") - lenObject = len("{}") - lenArray = len("[]") +const ( + bytesNull = "null" + bytesTrue = "true" + bytesFalse = "false" + bytesObject = "{}" + bytesArray = "[]" ) var bytesPool = sync.Pool{}