Introduction to packaging Go software for Debian

This is an introductory tutorial for making Debian packages specifically for software written in Go. If you need any help, feel free to ask on debian-go@lists.debian.org or #debian-golang.



Requirements

This tutorial assumes:

gophian is experimental software! Please report any problems to: https://codeberg.org/Maytha8/gophian/issues

Step 0: Before starting

Check if already packaged

You'll want to check if the package is already in Debian, and you can use gophian to achieve this.

gophian search <IMPORTPATH>

Check for WNPP bugs

You also want to check for any existing WNPP bugs, to avoid duplicate effort and announce your Intent to Package. This can be done using wnpp-check (from the devscripts package, see man wnpp-check for more info). Please refer to section 5.1 of the Developers' Reference.

Estimate packaging effort

gophian can be used to estimate the amount of work needed to packaging a certain piece of software. i.e. gophian will roughly list any dependencies that also need to be packaged.

gophian estimate <IMPORTPATH>

Step 1: Generate initial packaging

Use gophian to create the initial packaging for your chosen piece of software.

gophian make <IMPORTPATH>

Pass --itp to generate an ITP bug template, which will be placed in itp.txt.

If the software you are packaging contains binaries (main packages), gophian will ask you what type of package you want to make. If you already know, you can pass the --type flag.

Step 2: Fill in the blanks

gophian will try to intelligently fill in as much information as possible, but there may be some holes. Use grep -r TODO debian/ to find such holes, and make sure to manually review all the generated files in the debian directory.

You need to:

Step 3: Build

Run sbuild!

Build failures are good! It means that the package is not yet complete, and you'll need to to diagnose and fix the problem.

Common problems include:

Step 4: Review and upload

For most people following this guide, this is the first time they are packaging a Golang package in Debian. Before moving further, it is a good idea to commit what you have to git, push to either your own repo or to a go-team repo, and seek feedback on either debian-go@lists.debian.org or #debian-golang on IRC.

If you are not a DD: seek a sponsor by sending a mail to debian-go@lists.debian.org. Creating a sponsorship-requests bug is unnecessary for packages within the Go team, and a list mail is often enough to get some attention.

If you are a DD: make sure a second pair of eyes has had a look at your work, then feel free to upload to NEW.