Using Go lang on ubuntu 17.04
ubuntu ubuntu go newbie install
25 May 2017I have been doing programming challenges using python and ruby on kattis and feel its time I tried solving them using a new language. How about go lang. I installed it via gvm I suppose it is to Go lang what rbenv is to ruby.
zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
run gvm version
to confirm it installed correctly, I happen to use zsh instead of bash. The script inserts some new lines at the end of ~/.zshrc
.
[[ -s "/home/cliff/.gvm/scripts/gvm" ]] && source "/home/cliff/.gvm/scripts/gvm"
Also needed an to install bison
sudo apt-get install bison
Just like installing ruby using rbenv, the install is a pain in terms of time. It installed go 1.4 pretty quickly but 1.5 calls for a bit of patience. I tried installing go1.5 through gvm and it didn’t work so I went for the latest major version when I was writing this.
gvm install go1.4 -B
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.8
If all went well.
set it as default gvm use go1.8 --default
Test it out
cat > hello.go
paste this code in:
then execute it go run hello.go
links: