The first thing you would need to do is install the Go compiler from source (as opposed to using a pre-packaged binary). We prefer installation from source, because if you are planning on deploying production circuit applications, it is imperative to know how to fetch and use specific revisions or branches of the Go toolchain.
The circuit requires any
go1.1.1-compatible release branch of the Go toolchain.
For your convenience, we include a self-contained recipe how to build Go from the source:
% cd ~ % hg clone -u go1.1.1 https://code.google.com/p/goThis will fetch the Go repo and place it into
~/go. You can use any location of your choice—just make sure this is reflected accordingly in the next step.
GOROOTto point to the local clone of the Go repo:
% export GOROOT=$HOME/go
% cd $GOROOT/src % ./all.bash
$GOROOT/bin. You should put this directory in your path:
% export PATH=$GOROOT/bin:$PATH
$GOCIRCUITbe the location where you would like to place the circuit project.
% hg clone -u release https://code.google.com/p/gocircuit $GOCIRCUIT
% export GOPATH=$GOPATH:$GOCIRCUIT
The circuit uses Apache Zookeeper, and so compiling the circuit requires access to the C include and library files of
the Zookeeper driver. However these files are produced, we assign the environment variable
ZKINCLUDE the path
to the directory containing the include files, and the variable
ZKLIB the path to the directory containing the library files. There are three ways to install the Zookeeper C driver.
For convenience, the circuit distribution includes a compiled Zookeeper C driver for 64-bit OS X platforms. To use it, just set
% export ZKINCLUDE=$GOCIRCUIT/misc/starter-kit-osx/zookeeper/include % export ZKLIB=$GOCIRCUIT/misc/starter-kit-osx/zookeeper/lib
A compiled Zookeeper C driver for 64-bit Linux platforms is also included in the circuit distribution. To use it, set
% export ZKINCLUDE=$GOCIRCUIT/misc/starter-kit-linux/zookeeper/include % export ZKLIB=$GOCIRCUIT/misc/starter-kit-linux/zookeeper/lib
% cd /tmp % wget http://www.gtlib.gatech.edu/pub/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz % tar xzf zookeeper-3.4.5.tar.gz
$PREFIXhere is the location where you would like to place the installation,
% cd zookeeper-3.4.5/src/c % ./configure --prefix=$PREFIX % make && make install
% export ZKINCLUDE=$PREFIX/include/zookeeper % export ZKLIB=$PREFIX/lib
cgocompiler how to find the Zookeeper include files and to statically link in the Zookeeper library:
% export CGO_CFLAGS="-I$ZKINCLUDE" % export CGO_LDFLAGS="$ZKLIB/libzookeeper_mt.a"
% cd $GOCIRCUIT/src/circuit/cmd % go install ./...
This step will instruct the Go compiler to build and install all circuit commands in
Add this directory to your
% export PATH=$PATH:$GOCIRCUIT/bin
Place all environment variables created during all previous steps into your startup scripts.
You are done!