This page is about packaging golang libraries in Debian.

The one-sentence summary: use dh-golang, see bottom of the page.

Table of contents:

Package naming

For github.com/mstap/godebiancontrol (which contains "go" already), the resulting Debian package name is golang-godebiancontrol-dev.

We use the -dev suffix to keep the namespace clean in case go supports shared libraries, which would then be shipped as golang-godebiancontrol.

In general, you should use the _import path_ for deriving a name, not the actual package name. Ideally, those are the same anyway. In case a package name already exists and you need a more specific one, add just enough qualifiers to make it more specific. As an example:

Assume code.google.com/p/go.net/websocket is uploaded as golang-websocket-dev, and you need to package github.com/stapelberg/websocket, then you would name the latter golang-stapelberg-websocket-dev. In case code.google.com/p/stapelberg/websocket pops up, that will be golang-codegooglecom-stapelberg-websocket-dev.

Where to store go src/pkg data?

Go libraries (not binaries!) are present in Debian only for the purpose of building binary packages. They should not be used directly for Go development. Instead, the well-documented and platform independent way of using “go get” should be used.

Why should I use “go get” instead of apt-get to install Go libraries?

I want to build a Go binary Debian package

Multi-Arch/cross-compiling

Go libraries don’t ship any binary objects, only their source. The go compiler (>= 2:1.1-2) can cross-compile for all supported architectures.

TODO

Example binary + library packaging

Use dh-golang, see http://anonscm.debian.org/gitweb/?p=collab-maint/dh-golang.git

It has an example/ directory with a control and rules file. In case you have any troubles with dh-golang, please contact stapelberg@

See http://anonscm.debian.org/gitweb/?p=collab-maint/golang-pq-dev.git for a library-only package (not using dh-golang (yet)).