Re: [protobuf] Command to generate compiler generated code for Golang

18 views
Skip to first unread message

Adam Cozzette

unread,
Aug 5, 2019, 6:46:39 PM8/5/19
to Niket Agrawal, Protocol Buffers
I think the first one specifies a plugin needed for gRPC, but if you're just using Go protobuf without gRPC then there is no need to specify a plugin.

On Mon, Aug 5, 2019 at 3:23 AM Niket Agrawal <nick...@gmail.com> wrote:
Hello,

I came across two versions of the command to produce the compiler generated code for the .proto files I wrote and I am seeking clarification on which one should I use for my purpose. I am using Golang for my application development so after installing the protoc comiler I already installed the protoc plugin for Golang. I presume a flag or a plugin should be passed to the command to let the compiler generate code for that particular language?

The first command I came across s mentioned on the GRPC Golang tutotials (https://grpc.io/docs/quickstart/go/

protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld

The second command that I came across is on the protocol buffers Golang tutorial page (https://developers.google.com/protocol-buffers/docs/gotutorial

protoc -I=$SRC_DIR --go_out=$DST_DIR $SRC_DIR/addressbook.proto

The main difference I see on comparing the two commands is that the first one specifies a plugin while the second one doesn't. Could anyone explain this difference and which one should work for my case?

Regards,
Niket

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/fb191364-d7a1-48f4-ae9a-4a71fd4c816b%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages