我正在嘗試使用 grpc go 中的插件方法生成服務這是我的 score.proto 文件syntax="proto3";option go_package="./livescore";service ScoreService{ rpc ListMatches(ListMatchesRequest) returns (ListMatchesResponse);}message ListMatchesRequest{ string country=1;}message MatchScoreResponse{ string score =1; bool live=2;}message ListMatchesResponse{ repeated MatchScoreResponse scores=1;}當我運行這個命令時protoc -I=. --go_out=. score.proto 它工作正常RegisterScoreServiceServer但也可以按照命令生成protoc -I=. --go-grpc_out=. score.proto 給我錯誤protoc-gen-go-grpc: program not found or is not executable我知道插件標志已被棄用,但是如何生成插件也是如此。它有點令人困惑,歡迎任何幫助
1 回答

蝴蝶不菲
TA貢獻1810條經驗 獲得超4個贊
如果您仔細查看文檔,它會提到要安裝的兩件事
$ go install google.golang.org/protobuf/cmd/[email protected] $ go install google.golang.org/grpc/cmd/[email protected]
對于您需要的第二個命令go install google.golang.org/grpc/cmd/[email protected]
也要安裝。
更多看這里
https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc#section-readme
- 1 回答
- 0 關注
- 278 瀏覽
添加回答
舉報
0/150
提交
取消