Go

Installing Google Go on Linux Ubuntu

2009
22
Nov
1

One command install, Bash script to install Google Go in one Go

#!/bin/bash
ARCH=386 #CHANGE this setting to amd64 if you are on 64 bit.
sudo apt-get install bison make gcc libc6-dev ed mercurial
{
cat ~/.bashrc; cat <<EOF
export GOROOT=$HOME/go
export GOARCH=$ARCH
export GOOS=linux
export GOBIN=$HOME/gobin
export PATH=$PATH:$GOBIN
EOF
}  > ~/temp.bashrc
 
mv ~/.bashrc ~/.bashrc.old
mv ~/temp.bashrc ~/.bashrc
 
export GOROOT=$HOME/go
export GOARCH=$ARCH
export GOOS=linux
export GOBIN=$HOME/gobin
export PATH=$PATH:$GOBIN
 
mkdir $GOBIN
hg clone -r release https://go.googlecode.com/hg/ $GOROOT
cd $GOROOT/src
./all.bash

Read More

Google Go HelloWorld Example Program

2009
22
Nov

code

File : hello.go

package main
import "fmt"
 
func main() {
	fmt.Printf("Hello World !!! \n")
}

Compiling & Running

 8g hello.go 
 8l hello.8
 ./8.out

Output

Hello World !!!

(Obviously Grinning )



Syndicate content