Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/gob: misleading error message for maps with NaN keys #24075

bcmills opened this issue Feb 23, 2018 · 0 comments


Copy link

commented Feb 23, 2018

The encoding/gob package emits an erroneous error message when attempting to encode a map containing irreflexive keys (such as math.NaN()):

The error message it returns is gob: encodeReflectValue: nil element, but encodeReflectValue is not part of the exported or documented API, and there are no nil elements involved.

Ideally, encoding/gob should correctly handle maps with irreflexive keys. That would likely require either a fix for #11104, or a change to map lookups to use representation equivalence instead of == (per #20660 (comment)).

If it isn't feasible for gob to handle irreflexive map keys, that restriction should be documented in the gob package, and the errors that gob methods return should describe the correct problem.

This issue parallels #14427.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.