我按照此鏈接https://grpc.io/docs/languages/go/quickstart/中的 gRPC 快速入門文檔進行操作,在重新生成 gRPC 代碼時出現錯誤(未知標志:--go_opt),如下所示。嘗試了所有選項但不起作用。它還給出(未知標志:--go-grpc_opt)錯誤。命令 -$ protoc \ --go_out=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config:. \ --go-grpc_out=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config:. \ --go-grpc_opt=paths=source_relative \ helloworld/helloworld.protoError - Unknown flag: --go_opt
3 回答

大話西游666
TA貢獻1817條經驗 獲得超14個贊
我有同樣的問題。我刪除了已安裝的 protobuf 編譯器,并在 https://grpc.io/docs/protoc-installation/中使用“安裝預編譯的二進制文件”選項重新安裝了 protobuf 編譯器。
sudo apt-get remove protobuf-compiler
$PB_REL="https://github.com/protocolbuffers/protobuf/releases"
$ curl -LO $PB_REL/download/v3.12.1/protoc-3.12.1-linux-x86_64.zip
$sudo apt install unzip
$unzip protoc-3.12.1-linux-x86_64.zip -d HOME/.local
$export PATH="$PATH:$HOME/.local/bin"
- 3 回答
- 0 關注
- 1101 瀏覽
添加回答
舉報
0/150
提交
取消