Professional Documents
Culture Documents
Installing Go Language in Ubuntu
Installing Go Language in Ubuntu
You need gcc and some supporting software like bison to compile go. Install the following.
In my case it is /home/fermi/go
Create it with
$mkdir go
$ mkdir 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.)
$ export PATH=$PATH:$GOBIN
GOBIN=/home/fermi/go/bin/
GOARCH=386
GOROOT=/home/fermi/go/hg
GOOS=linux
4) Compile Go
$ cd $GOROOT/src
$ ./all.bash
Now wait for some time. The compilations will proceed and will be
completed with the following message
--- cd ../test
N known bugs; 0 unexpected bugs
5) Test go
Your go language system is ready to go.:D
Now let us write a hello world program and test it.
Create the following program in your favourite editor and save it as hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
$ 8g hello.go
$ 8l hello.8
$./8.out