Google adsense


Monday, February 15, 2010

Portable Ubuntu

It's very nicely...
You can take more info from Mongolian or English.

Installing Go on Ubuntu

Info source:
See also:
Tech talk (1 hour) (PDF)

Python + C = Go. Google's Programming Language

1. Install Pre-requisites on ubuntu.

You need gcc and some supporting software like bison to compile go. Install the following.

$ sudo apt-get install bison gcc libc6-dev ed

The go repository uses mercurial version controls system .
Install mercurial with the following command.

$ apt-get install mercurial

2. Set up the environment variables.

Create a folder named go in your home directory.


$mkdir go

Create bin direcory inside go .

$ mkdir go/bin

The above directory will contain your go compiler.
Next, you have to set u several variables.

$ export GOROOT=/home/fermi/go/hg
$ export GOOS=linux
$ export GOARCH=386
$ export GOBIN=/home/fermi/go/bin

( Note: You need not create the folder hg. You can also add the above
four lines along with the PATH variable below to the .bashrc file
if you are planning to use go regularly.)

Update your PATH variable .

$ export PATH=$PATH:$GOBIN

Check the environment variables with.

$ env | grep '^GO'

show like this.


3. Grab the source code from mercurial

$hg clone -r release $GOROOT

Wait for downloading.

4. Compile Go

$ cd $GOROOT/src
$ ./all.bash

Wait for compiling. Process will be completed with the following message

--- cd ../test
0 known bugs; 0 unexpected bugs

5. Test go

Write a hello world program.
Create a folder named mysrc in go dir then hello.go inside mysrc dir.
hello.go as like

package main

import "fmt"

func main() {
fmt.Printf("hello, world\n")

To compile hello.go run.

$ 8g hello.go

The above command produced and intermediate file hello.8.
Next you have to link it.

$ 8l hello.8

The executable is placed as 8.out. Finally run the executable.


Thank you, Fermi (