1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00
This commit is contained in:
Tao Wen
2017-06-29 20:40:25 +08:00
parent fb382c0ec1
commit 1253b8edd3
4 changed files with 28 additions and 28 deletions

View File

@ -57,7 +57,7 @@ func (encoder *arrayEncoder) EncodeInterface(val interface{}, stream *Stream) {
return
}
elemType := encoder.arrayType.Elem()
if encoder.arrayType.Len() == 1 && (elemType.Kind() == reflect.Ptr ||elemType.Kind() == reflect.Map) {
if encoder.arrayType.Len() == 1 && (elemType.Kind() == reflect.Ptr || elemType.Kind() == reflect.Map) {
ptr := uintptr(e.word)
e.word = unsafe.Pointer(&ptr)
}

View File

@ -1,11 +1,11 @@
package jsoniter
import (
"encoding"
"encoding/base64"
"encoding/json"
"unsafe"
"reflect"
"encoding"
"unsafe"
)
type stringCodec struct {
@ -419,7 +419,7 @@ func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
}
encoding := base64.StdEncoding
src := iter.SkipAndReturnBytes()
src = src[1: len(src)-1]
src = src[1 : len(src)-1]
decodedLen := encoding.DecodedLen(len(src))
dst := make([]byte, decodedLen)
len, err := encoding.Decode(dst, src)

View File

@ -3,10 +3,10 @@ package jsoniter
import (
"bytes"
"encoding/json"
"fmt"
"github.com/json-iterator/go/require"
"io/ioutil"
"testing"
"fmt"
)
func Test_new_decoder(t *testing.T) {
@ -73,7 +73,7 @@ func Test_use_number_for_unmarshal(t *testing.T) {
func Test_marshal_indent(t *testing.T) {
t.Skip("WIP")
should := require.New(t)
output, err := json.MarshalIndent(struct{
output, err := json.MarshalIndent(struct {
F1 int
F2 []int
}{1, []int{2, 3, 4}}, "", " ")