8000 encoding/gob: misleading error message for maps with NaN keys · Issue #24075 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
encoding/gob: misleading error message for maps with NaN keys #24075
Closed
@bcmills

Description

@bcmills

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0