mirror of
https://github.com/json-iterator/go.git
synced 2024-11-27 08:30:57 +02:00
fix 1.6 compatibility
This commit is contained in:
parent
11975d2a26
commit
368bd0c1d8
@ -166,7 +166,7 @@ func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||
|
||||
// Extract and sort the keys.
|
||||
keys := realVal.MapKeys()
|
||||
sv := make([]reflectWithString, len(keys))
|
||||
sv := stringValues(make([]reflectWithString, len(keys)))
|
||||
for i, v := range keys {
|
||||
sv[i].v = v
|
||||
if err := sv[i].resolve(); err != nil {
|
||||
@ -174,7 +174,7 @@ func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||
return
|
||||
}
|
||||
}
|
||||
sort.Slice(sv, func(i, j int) bool { return sv[i].s < sv[j].s })
|
||||
sort.Sort(sv)
|
||||
|
||||
stream.WriteObjectStart()
|
||||
for i, key := range sv {
|
||||
|
Loading…
Reference in New Issue
Block a user