mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-01-29 05:00:09 +08:00
bug fix: UnmarshalJSON should take a pointer
This commit is contained in:
parent
e9ca112fea
commit
ab8c6cbfd1
@ -70,7 +70,7 @@ func InfoToP2pAddrs(pi *PeerInfo) ([]ma.Multiaddr, error) {
|
||||
return addrs, nil
|
||||
}
|
||||
|
||||
func (pi PeerInfo) Loggable() map[string]interface{} {
|
||||
func (pi *PeerInfo) Loggable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"peerID": pi.ID.Pretty(),
|
||||
"addrs": pi.Addrs,
|
||||
@ -88,7 +88,7 @@ func (pi PeerInfo) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(out)
|
||||
}
|
||||
|
||||
func (pi PeerInfo) UnmarshalJSON(b []byte) error {
|
||||
func (pi *PeerInfo) UnmarshalJSON(b []byte) error {
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal(b, &data)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user