🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #1376

Bug#1151333: dh-go: a build pattern that matches nothing becomes a target, and the build fails on a directory name

#1376
From: Juan Manuel Mendez Rey
Date: Mon, 19 Oct 2026 18:50
58 lines
4005 bytes
Package: dh-go
Version: 1.69
Severity: normal

get_targets() calls "go list -e". With -e, a pattern that matches no package
comes back as if it were a package name. The code drops only the pattern
built from DH_GOPKG, so any other pattern from DH_GOLANG_BUILDPKG stays in
the list of targets.

The build step opens every target as a directory under the build directory,
so it stops here:

  dh_auto_build: error: Unable to open directory
  _build/src/github.com/theupdateframework/go-tuf/v0/... No such file or directory

That path is a pattern, not a directory. The message does not say that one of
the patterns in DH_GOLANG_BUILDPKG matched nothing, and that is the real
problem. I hit this while porting golang-github-theupdateframework-go-tuf to
dh-go. The module in that pattern was not in go.work yet, which was my
mistake in debian/rules, but the message took a long time to understand.

Please merge
https://salsa.debian.org/go-team/dh-go/-/merge_requests/6

--- a/lib/Debian/Debhelper/Buildsystem/golang.pm
+++ b/lib/Debian/Debhelper/Buildsystem/golang.pm
@@ -1282,9 +1282,19 @@ sub get_targets {
     );
     my @targets = split(/\n/, $output);
 
-    # Ensure that the pattern "$ENV{DH_GOPKG}/..." with three
-    # literal dots is not included in the targets.
-    @targets = grep { !m{$ENV{DH_GOPKG}/\.\.\.} } @targets;
+    # With "go list -e", a pattern which matches no package comes back as
+    # if it were a package. Such a target is not a package. Later steps
+    # open every target as a directory of the build directory, so the
+    # build stops with "Unable to open directory", which does not say
+    # which pattern is wrong. Drop those targets and name them instead.
+    my @unresolved = grep { m{/\.\.\.} } @targets;
+    if (@unresolved) {
+        warning("These build patterns match no package:");
+        foreach my $pattern (sort uniq(@unresolved)) {
+            warning("   - $pattern");
+        }
+    }
+    @targets = grep { !m{/\.\.\.} } @targets;
 
     # Remove all targets that are matched by one of the regular expressions
     # in DH_GOLANG_EXCLUDES.

A warning keeps the current behaviour of going on with the targets that did
resolve. An error would be fine by me as well, and it would catch the case
where a package silently stops building part of itself.
Technical Details
Message-ID: <NQ0AN-6AfM-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Juan Manuel Mendez Rey <juan.mendezr@proton.me>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1151333: dh-go: a build pattern that matches nothing becomes a target, and the build fails on a directory name
Date: Mon, 19 Oct 2026 20:50:01 +0200
Message-ID: <NQ0AN-6AfM-5@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Mon Oct 19 18:47:10 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.44
Reply-To: Juan Manuel Mendez Rey <juan.mendezr@proton.me>, 1151333@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+pkg-go@tracker.debian.org
X-Debian-Pr-Message: report 1151333
X-Debian-Pr-Package: dh-go
X-Debian-Pr-Source: dh-go
Feedback-ID: 176548819:user:proton
X-Pm-Message-ID: 59bcaa120ee97d7e409991415496f5854635e2d2
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1997571
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 58
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 19 Oct 2026 18:44:55 +0000
X-Original-Message-ID: <52db95c8e0b1717367014bd957429d63@proton.me>