#1150077 dh-go: XS-Go-Import-Path check never runs, it looks for go.mod in the build directory

Package:
dh-go
Source:
dh-go
Submitter:
Juan Manuel Mendez Rey
Date:
2026-10-22 23:35:02 UTC
Severity:
normal
#1150077#5
Date:
2026-10-05 16:06:51 UTC
From:
To:
The check added in 1.69 reads the go.mod from the build directory:

  my $gomodfile = $this->get_buildpath('go.mod');
  if (!-e $gomodfile) {
      warning("package does not provide 'go.mod', please add it.");
      return;
  }

get_buildpath returns the build directory when there is one, and
DEFAULT_BUILD_DIRECTORY is _build for compat 14 and later. The sources are
copied to _build/src/$DH_GOPKG, so _build/go.mod never exists. For every
package at compat 14 the check therefore returns early without comparing
anything, and the log gets a warning saying the package provides no go.mod
while it does ship one.

Please read it from the source directory instead:
--- a/lib/Debian/Debhelper/Buildsystem/golang.pm
+++ b/lib/Debian/Debhelper/Buildsystem/golang.pm
@@
-    my $gomodfile = $this->get_buildpath('go.mod');
+    my $gomodfile = $this->get_sourcepath('go.mod');

#1150077#10
Date:
2026-10-22 23:32:02 UTC
From:
To:
Patch as a merge request now:
https://salsa.debian.org/go-team/dh-go/-/merge_requests/7

Verified on golang-github-bgentry-go-netrc 0.0~git20140422.9fd32a8-2 in a clean
unstable chroot: the warning goes from six occurrences to none, and with a wrong
XS-Go-Import-Path the check fires, so the comparison runs again. One caveat is in
the merge request. The comparison calls error(), so five packages whose
XS-Go-Import-Path lacks the /vN of their module line would FTBFS once it works.