2

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.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Mark Smith
  • 437
  • 1
  • 6
  • 11

1 Answers1

0

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

Norbert
  • 6,026
  • 3
  • 17
  • 40