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 (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 is uploaded as golang-websocket-dev, and you need to package, then you would name the latter golang-stapelberg-websocket-dev. In case 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


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.


Example binary + library packaging

Use dh-golang, see

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

See for a library-only package (not using dh-golang (yet)).