Skip to content

Commit

Permalink
fields must be capital letter fields
Browse files Browse the repository at this point in the history
  • Loading branch information
snissn committed Dec 4, 2022
1 parent dfdee44 commit c24e1c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pinner/pinmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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++ {
Expand Down
2 changes: 1 addition & 1 deletion pinner/pinmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c24e1c4

Please sign in to comment.