
This article helps you through the Installation procedure of Google GO on Ubuntu 9.10 Karmic Koala Operating System .
In my older posts on Talkonsomething ,I described about Google GO programming language feature and what new in Google GO .
Step 1 : In order to install Go compilation environment in Ubuntu 9.10 depends on the following environment variables which has to be set prior to Go installation .
—————————————————————————————————————————————
a. $GOROOT : Root of the Go tree , directory to check out the Go project .
- Go to Terminal
- Enter the following command
$ export GOROOT=/home/your-name/hg
NOTE: Don’t create the directory hg , it will be automatically created when you check out the code
—————————————————————————————————————————————
b. $GOOS : Name of the Operating System , since we are using linux this environment variable has to be set with linux.
- Go to Terminal
- Enter the following command
$ export GOOS=linux
—————————————————————————————————————————————
c.$GOARCH : Name of the target compilation architecture . if you are using
amd64for AMD 64 bit processor386(32-bit x86) Intel 32 bit process andarm(32-bit ARM, an incomplete port)
Note: Based on your system configuration set the $GOARCH environment variable with the above list only the values which are bold ones. In my case its Inter 32 so the following will be my $GOARCH environment variable .
- Go to Terminal
- Enter the following command
$ export GOARCH=386
—————————————————————————————————————————————
d.$GOBIN : Specify any directory in which the binaries files should be installed. This specifies the path in which the GO compiler should be installed
- Create a new create called bin say in /home/your-name/bin
- Provide read ,write ,execute permission for the bin directory .
$ chmod 777 /home/your-name/bin
$ export GOBIN=/home/your-name/bin
$ export PATH=$PATH:/home/your-name/bin
- In order to check all the environment is set type following command
$ env|grep '^GO'
GOBIN=/home/your-name/bin
GOARCH=386
GOROOT=/home/your-name/hg/
GOOS=linux
This confirms all the environment variables are set perfectly you are ready for Installation of GO .
—————————————————————————————————————————————
Step 2 : Fetch the GO Source files from the repository using Mercurial .
- If Mercurial is not installed on your System , you can install it with apt-get command and also from the Ubuntu Synaptic package Manager.Mercurial
$ sudo apt-get install mercurial
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT


—————————————————————————————————————————————
Step 3 : The Go tool chain is written in C. To build it, you need to have GCC, the standard C libraries, the parser generator Bison, and the text editor ed installed.
$ sudo apt-get install bison gcc libc6-dev ed
—————————————————————————————————————————————
Step 4 : In order to build the Go distribution on Ubuntu run the following commands in the terminal mode
- Change directory $GOROOT ie /home/your-name/hg directory
$ cd $GOROOT/src
$./all.bash
--- cd ../test N known bugs; 0 unexpected bugs
—————————————————————————————————————————————
Finally Now Google Go is Installed on your Ubuntu 9.10 OS . In my Next post i will explaining . How to write Hello World Example using Go if time permits .
Hope this helps ! , If you find it useful please Spread a word about Talkonsomething.com , you can also follow me on twitter here
“Open Source Rocks !!!!!”
—————————————————————————————————————————————
Related posts
- How to Install Google gccgo compiler in Ubuntu 9.10 Karmic Koala
- Installation guide for Novel’s Mono,Mono-develop,Xsp2 Server in Ubuntu 9.10 Karmic Koala
- Backing up and Restoring Ubuntu applications while upgrading from Ubuntu 9.04 to Ubuntu 9.10 Karmic Koala
- Installation Procedure for Rails Environment on Windows
- HOW TO RUN CRYSTAL REPORTS IN UBUNTU LINUX
In the GOOS command you mistakenly wrote GOROOT=linux
Thanks a lot. It has been very helpful to me.
Just some precisions:
for $GOROOT, it seems better like this:
export GOROOT=/home/your-name/hg
and for $GOOS, it is:
export GOOS=linux
@Alex @meteor77 Thanks for your comments , edited again accordingly .
m having a problem with the final compilation,
pls help…….
this is the code snippet of the error:
rm -f _test/path.a _gotest_.8
make[2]: Leaving directory `/root/hg/src/pkg/path’
make[2]: Entering directory `/root/hg/src/pkg/path’
8g -o _gotest_.8 path.go path_test.go
rm -f _test/path.a
gopack grc _test/path.a _gotest_.8
make[2]: Leaving directory `/root/hg/src/pkg/path’
— FAIL: path.TestWalk
1. error expected, none found
node testdata/d/x mark = 2; expected 1
node testdata/d/y mark = 2; expected 1
node testdata/d/z mark = 2; expected 1
node testdata/d/z/u mark = 2; expected 1
node testdata/d/z/v mark = 2; expected 1
FAIL
make[1]: *** [test] Error 1
make[1]: Leaving directory `/root/hg/src/pkg/path’
make: *** [path.test] Error 2
@Hemant Check your mail