Anton Sobinov
Anton Sobinov

Reputation: 1

Error compiling protobuf .proto file with proto-gen-go-grpc: when -address isn't specified, you must include -stream-stats-catapult-json

I have proto-gen-go-grpc plugin ver 1.1.0, and keep getting error during compiling my .proto file:

ERROR:

2021/07/31 21:31:43 [profiling] error parsing flags: when -address isn't specified, you must include -stream-stats-catapult-json --go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.

I'm using this command for compiling:

protoc --go-grpc_out=. -I . blog.proto

I've found the source code of proto-gen-go-grpc module with -address and -stream-stats-catapult-json flags: https://github.com/grpc/grpc-go/blob/master/profiling/cmd/flags.go

But all my attempts to use this flags like this:

protoc --go-grpc_opt=stream-stats-catapult-json=json.txt --go-grpc_out=. -I . blog.proto

protoc --stream-stats-catapult-json=json.txt --go-grpc_out=. -I . blog.proto

are unsucessfull.

I don't need to use -address flag because I have no remote server for profiling, also I don't need to use profiling too. How can I complile my proto files using correct flags?

Upvotes: 0

Views: 932

Answers (1)

Anton Sobinov
Anton Sobinov

Reputation: 1

Unforchenately, the reason of this error remains unknown. But despite this, I can list the steps that helped fix it. Вy the way, this error manifested itself not only in prtobuff compiller. It was caused by profiler, for example by the "web" command in pprof tool.

So I've made folowing steps:

  1. removed all go-related folders and files from the OS (Windows 10)

  2. installed the go lang from this link: https://golang.org/dl/

and followed the instructions from this link: https://golang.org/doc/install

  1. downloaded protocol buffers for windows form this link: https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-win64.zip

and put the file protoc.exe from \bin foler to the folder C:\Program Files\Go\bin

  1. installed the 'protoc-gen-go-grpc' plugin by this two commands in the bash:

    $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

    $ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

  2. used the bash of Git for Windows to run the compiler:

    $ protoc --go_out=. -I . blog.proto

    $ protoc --go-grpc_out=. -I . blog.proto

and then my files was sucessfully compiled.

Upvotes: 0

Related Questions