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

https://developers.google.com/protocol-buffers/docs/gotutorial

First we download from GitHub protocolbuf project:

git clone https://github.com/protocolbuffers/protobuf.git

Then we setup our Go project.

mkdir -p ~/protobuf/src/github.com/protocolbuffers/protobuf/examples/

From git repo, locate examples folder

cd ~/GIT/protobuf/examples

Then copy the source code to our Go project:

cp Makefile ~/protobuf/src/github.com/protocolbuffers/protobuf/examples
cp *go ~/protobuf/src/github.com/protocolbuffers/protobuf/examples
cp *proto ~/protobuf/src/github.com/protocolbuffers/protobuf/examples

Setup the GOHOME variable

export GOPATH=~/protobuf

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

https://github.com/protocolbuffers/protobuf/releases

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 github.com/golang/protobuf/protoc-gen-go

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/github.com/protocolbuffers/protobuf/examples
make clean
make go
Building Go Tutorial

Running the sample

Adding records
Listing records

Create gcp YouTube api key for mpsyt

After running mpsyt for a while, I started to face an issue with the latest branch:

Looking for “Tiesto” media

The following error was coming up when trying to search:

Error fetching data. Possible network issue.
Youtube Error 403: The request cannot be completed because you have exceeded your quota.


No results from search comman

Then, looking into mpsyt github repo you can find there the solution:

https://github.com/mps-youtube/mps-youtube/wiki/Troubleshooting

You will need to create from Google Cloud Platform key to access YouTube v3 API.

Go to GCP console, from your project create an API key for YouTube V3:

GCP console. YouTube Data API v3

Once you generate API v3, (I selected one for cli), I updated mpsyt client with the new key:

set api_key command inside mpsyt

Voila, now I’m able to use mpsyt downloder again to access my favorite stuff: