map: invalid keys sort
wI2L opened this issue · 4 comments
@achille-roussel Hello,
As I was reading the code of the package, I noticed the sortKeys
function that is created based on the map key type to encode, and saw that you sort on the reflect.Value
value rather than the string representation of the key.
I was perplex to find that as an optin functionality, since the package aims to be compliant with the standard library, unless I misunderstood the README.
The following example shows that the output is different when using a map with keys of type int
: https://play.golang.org/p/1ddbUssdbaf
The only reference to a map with keys of signed/unsigned-integer kind I could find in the tests is at
Line 190 in bc545e9
@wI2L Thanks for reporting the issue! And you're correct, this seems like a mistake.
Would you be available to submit a fix? Otherwise I'll take a look at it sometimes this weekend.
@achille-roussel Sure, I'll send a PR tomorrow, this is a quickfix.
Any update?
I'm working on it.