This page is about packaging golang.org libraries in Debian.

Facts

Package naming

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

Where to store go src/pkg data?

TODO

Example packaging

debian/rules:

# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

GOPKG := github.com/mstap/godebiancontrol
TMPGOPATH = $(CURDIR)/debian/golang-godebiancontrol/usr/lib/gocode

override_dh_auto_install:
        mkdir -p ${TMPGOPATH}/src/${GOPKG}
        tar cf - --exclude=debian . | (cd "${TMPGOPATH}/src/${GOPKG}" && tar xvf -)
        # Ensure that GOPATH is clean: It should only contain the temporary
        # /usr/src/golang containing the package we want to install and the
        # /usr/src/golang of the system we are building on. It should
        # specifically NOT contain the user’s local ~/gocode.
        GOPATH=${TMPGOPATH}:/usr/lib/gocode go install -v ${GOPKG}

%:
        dh $@