From c24e1c408a86f904747f4b36c8ba58c78b90b839 Mon Sep 17 00:00:00 2001 From: mike seiler Date: Sat, 3 Dec 2022 22:04:05 -0700 Subject: [PATCH] fields must be capital letter fields --- pinner/pinmgr.go | 10 +++++----- pinner/pinmgr_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pinner/pinmgr.go b/pinner/pinmgr.go index 2848d9b8..9bc6a2e0 100644 --- a/pinner/pinmgr.go +++ b/pinner/pinmgr.go @@ -361,8 +361,8 @@ type AddrInfoString struct { Addrs []string } type PinningOperationSerialize struct { - po PinningOperation - peers []AddrInfoString + Po PinningOperation + Peers []AddrInfoString } func encode_msgpack(po *PinningOperation) ([]byte, error) { @@ -377,7 +377,7 @@ func encode_msgpack(po *PinningOperation) ([]byte, error) { newpeer := AddrInfoString{ID: peers[i].ID, Addrs: newaddrs} serialPeers = append(serialPeers, newpeer) } - savedObject := PinningOperationSerialize{po: *po, peers: serialPeers} + savedObject := PinningOperationSerialize{Po: *po, Peers: serialPeers} return msgpack.Marshal(&savedObject) } func decode_msgpack(po_bytes []byte) (*PinningOperation, error) { @@ -386,9 +386,9 @@ func decode_msgpack(po_bytes []byte) (*PinningOperation, error) { if err != nil { log.Fatal(err) } - po := next.po + po := next.Po newPeers := []*peer.AddrInfo{} - peers := next.peers + peers := next.Peers for i := 0; i < len(peers); i++ { newaddrs := []ma.Multiaddr{} for j := 0; j < len(peers[i].Addrs); j++ { diff --git a/pinner/pinmgr_test.go b/pinner/pinmgr_test.go index 92e29696..5b18c9ee 100644 --- a/pinner/pinmgr_test.go +++ b/pinner/pinmgr_test.go @@ -114,7 +114,7 @@ func TestEncodeDecode(t *testing.T) { fmt.Println(err) } peer := []*peer.AddrInfo{{ID: peer.ID("12D3KooWCsxFFH242NZ4bjRMJEVc61La6Ha4yGVNXeEEwpf8KWCX"), Addrs: []ma.Multiaddr{addr}}} - po := &PinningOperation{Peers: peer} + po := &PinningOperation{Peers: peer, Name: "pinning operation name"} bytes, err := encode_msgpack(po) if err != nil { fmt.Println(err)