Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve gogo proto deprecation #1359

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/v0/finder/client/libp2p/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/multiformats/go-multihash"
"google.golang.org/protobuf/proto"
)

type Client struct {
Expand Down Expand Up @@ -123,9 +124,9 @@ func (c *Client) GetStats(ctx context.Context) (*model.Stats, error) {
}

func (c *Client) sendRecv(ctx context.Context, req *pb.FinderMessage, expectRspType pb.FinderMessage_MessageType) ([]byte, error) {
resp := new(pb.FinderMessage)
var resp pb.FinderMessage
err := c.p2pc.SendRequest(ctx, req, func(data []byte) error {
return resp.Unmarshal(data)
return proto.Unmarshal(data, &resp)
})
if err != nil {
return nil, fmt.Errorf("failed to send request to indexer: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion api/v0/finder/pb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GO = $(PB:.proto=.pb.go)
all: $(GO)

%.pb.go: %.proto
protoc --proto_path=$(GOPATH)/pkg/mod:. --proto_path=/usr/include --gogofaster_out=. $<
docker run -v $(CURDIR):/defs -w /defs namely/protoc-all -d . -l go --go-module-prefix github.com/ipni/storetheindex/api/v0/finder/pb -o .

clean:
rm -f *.pb.go
Expand Down
Loading