[pkg-go] testdata/ directories and incorrect test path patches

Michael Stapelberg stapelberg at debian.org
Fri Feb 16 08:28:19 UTC 2018


I noticed recently that we have 13 packages in the archive which ship with
a patch similar to
i.e. a patch which modifies the upstream code to look for testdata files
not in the current directory, but in the Debian sources.

The cited rationale for such a patch is an apparent issue with the Debian
packaging executing tests in the wrong directory.

This is incorrect: dh-golang runs go test, which ensures the directory is
correct. Instead, what is happening is that dh-golang constructs a
temporary GOPATH and, by default, only copies Go source files into that

The proper solution is to have dh-golang install the required files. Up
until dh-golang 1.30, this would be accomplished with e.g. export
DH_GOLANG_INSTALL_EXTRA := html/charset/testdata in debian/rules.

To make this a little easier for everyone, I just uploaded dh-golang 1.31,
which honors the testdata/ convention and copies testdata/ contents by

I will also update the affected packages and drop the now-unnecessary patch
from them. I just wanted to bring this to people’s attention to ensure that
— when required — we add installation directives to debian/rules instead of
patching upstream source.

if you’re curious about more details of the inner workings of dh-golang,
and let me know if you have any questions.


Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-go-maintainers/attachments/20180216/d5bd1396/attachment.html>

More information about the Pkg-go-maintainers mailing list