Saturday, May 14, 2011

Installing Google Go system-wide on Ubuntu

Just some quick notes. This assumes all necessary packages for C dev are installed (sudo apt-get install bison ed gawk gcc libc6-dev make).

As root (sudo bash):

bash# apt-get install mercurial mercurial-common mercurial-git
bash# cd /usr/local
bash# hg clone -u release https://go.googlecode.com/hg/ go
bash# cd go/src
bash# export GOBIN=/usr/local/bin
bash# ./all.bash

After this, the Go toolchain will be installed in /usr/local/bin, with all supporting files in /usr/local/go. Ubuntu should already have /usr/local/bin in the path for all users.

To test (as a normal user):

bash$ cd /tmp
bash$ cat >hello.go <
> package main
>
> import "fmt"
>
> func main() {
> fmt.Printf("hello, world\n")
> }
> EOF
bash$ 6g hello.go
bash$ 6l hello.6
bash$ ./6.out
hello, world
bash$ rm hello.go hello.6 6.out

No comments:

Post a Comment