O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once the command has executed successfully, hello.pb.go will be created inside the proto directory, which will look like as shown in the following screenshot:

Let’s understand the .proto file we have written:

  • syntax = "proto3";: Here we specify that we are using proto3 syntax, which makes the compiler understand that the protocol buffer has to be compiled with version 3. If we don't specify the syntax explicitly then the compiler assumes we are using proto2
  • service Say { rpc Hello(Request) returns (Response) {} }: Here we defined an RPC service with the name Say and a Hello method that takes Request and returns a Response ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required