Protocol Buffers in go

If you want to get started quickly with Google Protocol Buffers in the Go Programming Language lets follow the guide from

First we download from GitHub protocolbuf project:

git clone

Then we setup our Go project.

mkdir -p ~/protobuf/src/

From git repo, locate examples folder

cd ~/GIT/protobuf/examples

Then copy the source code to our Go project:

cp Makefile ~/protobuf/src/
cp *go ~/protobuf/src/
cp *proto ~/protobuf/src/

Setup the GOHOME variable

export GOPATH=~/protobuf

Then we install protobuf protoc compiler: Download protoc from following location then unzip in your preferred folder

For instance I unzip into my protoc folder:

Unzipping protoc compiler

Update your path to locate protoc

export PATH=~/protoc/bin:$PATH

Then we install go plugin

go get -u

Update your path to locate protoc-gen-go. (Installed in previous step by go get)

export PATH=~/protobuf/bin:$PATH

This is the go project setup, now lets build the tutorial.

Go to examples folder

cd ~/protobuf/src/
make clean
make go
Building Go Tutorial

Running the sample

Adding records
Listing records

Leave a Reply

Your email address will not be published. Required fields are marked *