Problems running protoc with proto_path to generate Gocode

Viewed 1289

I am having a little bit of an issue to correctly understand the format of running protoc to generate Go source from proto files.

I have tried

protoc --proto_path=api/auth-service api/auth-service/proto/*.proto --go_out=pluigins=grpc:pb

and

protoc --proto_path=api/auth-service/proto/*.proto --go_out=pluigins=grpc:pb

The above always print

api/auth-service/proto/*.proto: warning: directory does not exist.

or

Missing input file.

eventually, after a lot of playing around it seems that thing works.

protoc --proto_path=api/auth-service api/auth-service/proto/*.proto --go_out=pluigins=grpc:pb

But I am very confused about the actual correct format (passing in the directory twice and the 2nd passing in *.proto)

I tried finding some syntax why it was working this way but I couldn't.

There was also passing -I instead of --proto_path.

1 Answers

You have to run with a named proto ( so replace the * with your proto filename, should fix it)

Related