我正在嘗試使用 grpc go 中的插件方法生成服務(wù)這是我的 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;}當(dāng)我運(yùn)行這個(gè)命令時(shí)protoc -I=. --go_out=. score.proto 它工作正常RegisterScoreServiceServer但也可以按照命令生成protoc -I=. --go-grpc_out=. score.proto 給我錯(cuò)誤protoc-gen-go-grpc: program not found or is not executable我知道插件標(biāo)志已被棄用,但是如何生成插件也是如此。它有點(diǎn)令人困惑,歡迎任何幫助
1 回答

蝴蝶不菲
TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
如果您仔細(xì)查看文檔,它會(huì)提到要安裝的兩件事
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 $ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
對(duì)于您需要的第二個(gè)命令go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
也要安裝。
更多看這里
https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc#section-readme
- 1 回答
- 0 關(guān)注
- 268 瀏覽
添加回答
舉報(bào)
0/150
提交
取消