Golang syntax highlighting in vi

Here’s how to set up the vi editor syntax highlighting for the Go language (golang) under Ubuntu 14.04 ‘Trusty’.

sudo apt-get install vim-gocomplete
sudo vim-addon-manager install go-syntax
sudo vim-addon-manager install gocode

A lot of people prefer tabs to be 4 spaces rather than the default 8. To get this add the following to either ~/.vimrc or to /etc/vim/vimrc

set tabstop=4
set shiftwidth=4
set softtabstop=4