{"id":225,"date":"2019-08-22T12:46:37","date_gmt":"2019-08-22T12:46:37","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=225"},"modified":"2019-11-13T15:56:59","modified_gmt":"2019-11-13T15:56:59","slug":"protocol-buffers-go","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/protocol-buffers-go\/","title":{"rendered":"Protocol Buffers and Go: Getting started"},"content":{"rendered":"\n

In this tutorial, we will see how protocol buffers can be used in the context of GO Language.<\/p>\n\n\n\n

What is Protocol Buffer<\/strong><\/p>\n\n\n\n

Protocol Buffers are data format which stores data in a structured format. Data in the protocol buffer format can be serialized and deserialized by multiple languages.<\/p>\n\n\n\n

Sounds Confusing. You can think it on lines of JSON, XML but it has loads of advantages to offer. Still confusing? then don’t worry as we go along the tutorial we will understand why even a new data format is even needed.<\/p>\n\n\n\n

Let’s see first with an example of the simplest protocol buffer file.<\/p>\n\n\n\n

person.proto<\/strong><\/p>\n\n\n\n

syntax = \"proto3\";\n\nmessage Person {\n    string name = 1;\n}<\/code><\/pre>\n\n\n\n

A couple of points to note about the above file.<\/p>\n\n\n\n