Thursday, November 12, 2009

Let's GO

GO..
is a new programming language introduced by Google. It is a compiled language but it has some features of interpreted languages so it has C/C++ like features as well as Python like features. GO is really fast almost like C. this is a lightweight language compared to some other languages and supports multi core machines and most importantly and as usual Google released the new language Open source.

How to install GO

First  you need to install mercurial on your machine. if you haven't installed it yet get the terminal and enter this command.

sudo easy_install mercurial

then you have to add an environment variable to your .bashrc file. actually you need to add four environment variables to the .basrc file in order to install GO.

in the Terminal type


gedit ~/.bashrc


scroll down to the last line and add the following lines after the last line of the file


export GOROOT=$HOME/go (you can specify any location)

then save it and restart the Terminal and type

hg clone -r release https://go.googlecode.com/hg/ $GOROOT

and then enter this

sudo apt-get install bison gcc libc6-dev ed

the source code of GO will be automatically downloaded to GOROOT

now we have add another three more environment variables before building the source

so again open the .bashrc file and add the following lines after the last line of the file

export GOBIN=$GOROOT/bin (you can specify any location) , this is the place where binaries will be put.

export GOOS=linux 
export GOARCH=386 (put your machines architecture here.. amd64, 386)

and then finally make sure your GOROOT is in the PATH so,add

export PATH=$PATH:$GOROOT

save the file and restart the terminal...
let's build the source and start to GO....

cd $GOROOT/src
./all.bash

right now you are finished if everything GOes well you will see something like that in the terminal (the number of known bugs may be vary from release to release)
--- cd ../test
0 known bugs; 0 unexpected bugs

ok.. now you have installed GO on your machine so, LET'S GO.....






Kesh....

No comments:

Post a Comment