Installing Protobuf
In this recipe, we will be installing Protobuf to generate Golang structures used in communication with Mesos.
Getting ready
Install Golang, Protobuf, and the Golang Protobuf bindings:
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable sudo apt-get update sudo apt-get install golang git export GOPATH=~/go export PATH=$PATH:$GOPATH/bin sudo apt-get install protobuf-compiler go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
How to do it...
- Create a project directory and go there:
mkdir -p $GOPATH/src/simple-scheduler cd $GOPATH/src/simple-scheduler
- Download the Mesos protobuf message definitions:
wget https://raw.githubusercontent.com/apache/mesos/170ac/include/mesos/v1/mesos.proto wget https://raw.githubusercontent.com/apache/mesos/170ac/include/mesos/v1/scheduler/scheduler.proto
- Tweak them to our needs. Change the default package of generated bindings to one that matches Golang. We will keep the whole project in one main package and the generated bindings should fit in...