File tree 1 file changed +12
-9
lines changed
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ package jsoniter
2
2
3
3
import (
4
4
"fmt"
5
- "github.com/modern-go/reflect2"
6
5
"io"
7
6
"reflect"
8
7
"sort"
9
8
"unsafe"
9
+
10
+ "github.com/modern-go/reflect2"
10
11
)
11
12
12
13
func decoderOfMap (ctx * ctx , typ reflect2.Type ) ValDecoder {
@@ -106,15 +107,17 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
106
107
}
107
108
}
108
109
109
- if typ == textMarshalerType {
110
- return & directTextMarshalerEncoder {
111
- stringEncoder : ctx .EncoderOf (reflect2 .TypeOf ("" )),
110
+ if typ .Kind () != reflect .String {
111
+ if typ == textMarshalerType {
112
+ return & directTextMarshalerEncoder {
113
+ stringEncoder : ctx .EncoderOf (reflect2 .TypeOf ("" )),
114
+ }
112
115
}
113
- }
114
- if typ . Implements ( textMarshalerType ) {
115
- return & textMarshalerEncoder {
116
- valType : typ ,
117
- stringEncoder : ctx . EncoderOf ( reflect2 . TypeOf ( "" )),
116
+ if typ . Implements ( textMarshalerType ) {
117
+ return & textMarshalerEncoder {
118
+ valType : typ ,
119
+ stringEncoder : ctx . EncoderOf ( reflect2 . TypeOf ( "" )) ,
120
+ }
118
121
}
119
122
}
120
123
You can’t perform that action at this time.
0 commit comments