November 23, 2009

Google Go language - install and run

It's too bad that it currently only supports Linux and OSX.  (I use Windows and Sparc Solaris.)  I think it'll eventually support other platforms, but for now, it's just Linux and OSX.

Platform

I've installed Ubuntu 9.10 on VMWare, assigning 40GB HDD and 1GB RAM.  Ubuntu 9.10 is much faster than previous version.

Compile and Install

First, installing Go.  Create ~/bin/ directory and add that to PATH.  Then follow the instruction on http://golang.org/doc/install.html I didn't have any issue at all.

Code Editor

After compiling Go lang, in $GOROOT directory, there are documents, samples, and syntax highlighting files for a few editors.  I use VIM, and installed $GOROOT/misc/vim/go.vim file.  Copy this file into ~/.vim/ directory.  And edit ~/.vimrc file:

let mysyntaxfile = "/home/MY_USER/.vim/go.vim"
syntax on
set nu
set ai
set tabstop=4
set ruler
set laststatus=2
set showmode
set expandtab
let loaded_matchparen=1
(First two lines are for go lang.)

Documents, Tutorials, Sample code

In $GOROOT/doc, the documents -- tutorial, document on Go memory, specification, FAQ, Go Course (day1-3) PDFs, effective go, and sample code are all there.  No need to download from the site separately.

... More on Go lang later.