File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ package jsoniter
22
33import (
44 "fmt"
5- "github.com/modern-go/reflect2"
65 "io"
76 "reflect"
87 "sort"
98 "unsafe"
9+
10+ "github.com/modern-go/reflect2"
1011)
1112
1213func decoderOfMap (ctx * ctx , typ reflect2.Type ) ValDecoder {
@@ -106,15 +107,17 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
106107 }
107108 }
108109
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+ }
112115 }
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+ }
118121 }
119122 }
120123
You can’t perform that action at this time.
0 commit comments