Posted at 18:54h
in
GO
by heridev
In this tutorial I'm going to show you one way to setup Golang and build your scripts into executable programs(binary files):
First of all you have to go into golang.org, download and install Golang depending on your development platform, in my case I'm using Mac OSX and if you already have installed
brew is just as easy as run from console:
[shell]
brew install go
brew install mercurial
brew install git
//installing godoc for creating package documentation
go get code.google.com/p/go.tools/cmd/godoc
[/shell]
After to install GO you have to declared and export "GOPATH" variable it is recommended to add it inside your user profile maybe if you are using bash you have to put the code into the file ~/.bashrc or in my case ~/.bash_profile or if you are using Zsh into the file ~/.zshrc so the code you have to put into your file looks something like:
[shell]
#go path
export GOPATH=$HOME/Golang
export PATH=$GOPATH/bin:$PATH
//use the following if you want to generate documentation for your package using godoc
export GOROOT=`go env GOROOT`
export PATH=$PATH:$GOROOT/bin
[/shell]