我遵循了这个链接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.proto
Error - Unknown flag: --go_opt
发布于 2020-07-18 10:10:04
我也有同样的问题。我删除了已安装的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"
发布于 2020-09-09 21:55:08
您遗漏了第四行:--go_opt=paths=source_relative \
。
https://stackoverflow.com/questions/62909028
复制相似问题