Package: dh-golang Version: 1.52 Severity: normal X-Debbugs-Cc: creekor...@debian.org, f...@debian.org
Hello team, While working on syncthing, I've noticed something weird with the way DH_GOLANG_EXCLUDES is interpreted. The following exclusion in d/rules: ``` export DH_GOLANG_EXCLUDES := meta ``` Will cause the exclusion of the following files from the build targets: ``` ./meta/copyright_test.go ./meta/gofmt_test.go ./meta/metalint_test.go ./lib/db/meta_test.go ./lib/db/meta.go ``` In my scenario, I only wanted to exclude files from the meta folder (i.e meta/*) so I've updated d/rules like this: ``` export DH_GOLANG_EXCLUDES := meta/ ``` And now, nothing is being filtered, previous files are now included in the build target. Trying to escape the exclusion: `meta\/` hasn't worked either way: previous files are still included in the build target. @foka (in CC) helped me fixing my syntax by using `meta($$|/)` as an exclusion, in order to match both meta/ and meta$. --- @foka has done a little analysis of the situation, and while this behavior is weird, it is definitely expected: dh-golang is doing a `go list $xs-go-import-path` against the package and in our situation, the meta directory would appear as github.com/syncthing/syncthing/meta (no trailing '/') and therefore this explain why it hasn't match against the DH_GOLANG_EXCLUDES regex. Maybe dh-golang can be improved to handle such case? (i.e trying to match both meta/ and meta$ in this scenario). --- @foka: the documentation about DH_GOLANG_EXCLUDES [1], is therefore currently false, since examples/ will not be excluded from build and test but from the .deb. Cheers, [1]: https://manpages.debian.org/testing/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html#DH_GOLANG_EXCLUDES -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 5.14.0-4-amd64 (SMP w/2 CPU threads) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages dh-golang depends on: ii debhelper 13.5.2 ii libdpkg-perl 1.20.9 ii perl 5.32.1-6 dh-golang recommends no packages. dh-golang suggests no packages. -- no debconf information