Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

peer.ID does not work as map key in JSON maps #79

@hsanjuan

Description

@hsanjuan

Since peer.IDs defines themselves as str, defining a map[peer.ID]<type> and marshaling that to JSON does not make use of the MarshalText() facility to encode the map keys. Somehow default encoding/decoding when doing it doesn't work (it decodes peers with different IDs but doesn't complain, which is worse).

See golang/go#28827

Probably doing the same thing as cids and switching to type ID struct { str string } would fix this.

However, this might be very breaking because people rely on doing pid1 == pid2 (and I think that would stop working, at least from outside this package? it is not clear from the Go documentation).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions