How to install a recent, managed version of golang on Ubuntu 14.04?

The Go programming language (golang) has multiple versions and multiple implementations. Some software requires a more recent version than the 1.2.1 in Ubuntu 14.04 via the golang-go package:

$ go version
go version go1.2.1 linux/amd64

Or the version available with the gccgo-go package:

go version xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3 linux/amd64

I guess that means it's based on gcc 4.9, which is a bit confusing but says:

The GCC 4.9 releases include a complete Go 1.2 implementation. The GCC 5 releases include a complete implementation of the Go 1.4 user libraries. The Go 1.4 runtime is not fully merged, but that should not be visible to Go programs.

Trying to install software using e.g. the go get command can be frustrating and unhelpful, generating core dumps or strange compilation errors.

What are the options for installing a more recent version? I need 1.5 or later right now, but would prefer a more general answer.

I don't want to just install a tar.gz package as suggested by the official documentation, since I want to get security updates etc. I'm actually alarmed to see that they recommend that.

I'm always nervous about installing from a ppa since they don't have security update guarantees, but that might be the best option, and https://launchpad.net/~ubuntu-lxc/+archive/ubuntu/lxd-stable seems like one option.


Go is now available as a possibly-older version via apt:

sudo apt-get install golang

or as an up-to-date snap:

sudo snap install --classic go

You may need to install snapd before you can run the above command:

sudo apt install snapd