亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

運行 protoc 命令不生成 Register 方法

運行 protoc 命令不生成 Register 方法

Go
紅顏莎娜 2022-11-08 16:36:18
我正在嘗試使用 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


查看完整回答
反對 回復 2022-11-08
  • 1 回答
  • 0 關注
  • 278 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號