Wednesday, July 24, 2013

How to install Golang 1.1 in Debian from repository

I like to use packages in Debian - it's easy to update and more stable.
Version of Go language in Debian Wheezy is 1.0.2, but we have 1.1 version in unstable (sid) branch, so let's use it.

Add sources list

It's not safe to just add "unstable" into sources list, so I chose to add it in this way: http://serverfault.com/a/382101/82650 , I'll quote text of Brendan Byrd here just to save it:

First, create the following files in /etc/apt/preferences.d:
security.pref:
Pin: release l=Debian-Security
Pin-Priority: 1000
Package: *
stable.pref:
Pin: release a=stable
Pin-Priority: 995
Package: *
unstable.pref:
Package: *
Pin: release a=unstable
Pin-Priority: 50
Now, creating a matching set for /etc/apt/sources.list.d:
security.list:
deb http://security.debian.org/   stable/updates  main contrib non-free
deb     http://security.debian.org/  testing/updates main contrib non-free
stable.list:
deb     http://ftp.us.debian.org/debian/    stable main contrib non-free
deb-src http://ftp.us.debian.org/debian/    stable main contrib non-free
unstable.list: Same as stable.list, except with unstable.

Install

Then run apt-get update and, finally:
aptitude install golang/unstable

Check

Check version:
go version

And check code execution like described in http://golang.org/doc/install#testing

1 comment: