iancoleman / orderedmap

orderedmap is a golang map where the keys keep the order that they're added. It can be de/serialized from/to JSON. It's based closely on the python collections.OrderedDict.
MIT License
356 stars 55 forks source link

fixed issue #5, detail: #7

Closed fredwangwang closed 6 years ago

fredwangwang commented 6 years ago
  1. refactor the maptoOrderedmap
  2. added another test
fredwangwang commented 6 years ago

ops, sorry. Seems like the implementation is wrong somewhere(Probably parsingslicetomap). I don't want to spend time during weekdays to review the code again 'cauze it is time consuming, but if you;re still interested, reply me back and I can see if I can get it fixed! Or debug urself :-) Or close me :-(

iancoleman commented 6 years ago

Thanks for this. The fix is in https://github.com/iancoleman/orderedmap/commit/fec04b9a4f6dd6d27c3f0b2c4df147fab396bc7f

I included the test from this pull request (which was failing) and it is now passing.

The change was to refactor mapToOrderedMap into two methods mapStringToOrderedMap and sliceStringToSliceWithOrderedMaps. This improves the parsing of these cases:

Thanks again for finding and reporting this issue.