Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown flag: --go_opt while regenerating gRPC code

Tags:

go

grpc

I followed the gRPC quickstart document in this link https://grpc.io/docs/languages/go/quickstart/ and while regenerating the gRPC code i am getting error ( Unknown flag: --go_opt) as shown below. Tried all the options but not working. It also gives ( Unknown flag: --go-grpc_opt) error.

Command -

$ 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
like image 948
BlockchainGeek Avatar asked Oct 16 '22 02:10

BlockchainGeek


1 Answers

I had a same issue. I removed the installed protobuf compiler and reinstalled protobuf compiler with "Install pre-compiled binaries" option in https://grpc.io/docs/protoc-installation/.

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"
like image 147
user13951318 Avatar answered Oct 21 '22 01:10

user13951318