🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug#1153462: dh-go: the DH_GOLANG_MODULE_MAPPINGS symlink points at the module path, not at where the module is installed

#3824
From: juan.mendezr
Date: Sun, 08 Nov 2026 20:30
68 lines
4506 bytes
Package: dh-go
Version: 1.71
Severity: important
Tags: patch
X-Debbugs-Cc: juan.mendezr@proton.me

A mapping whose replacement is a /vN module cannot work, because Debian
installs such a module at the path without the suffix and the symlink is built
from the module path. With

  export DH_GOLANG_MODULE_MAPPINGS := github.com/peterbourgon/diskv:github.com/peterbourgon/diskv/v3

the build stops with

  github.com/peterbourgon/diskv@v2.0.1+incompatible
    (replaced by ./src/MAPPINGS/github.com/peterbourgon/diskv):
    reading src/MAPPINGS/github.com/peterbourgon/diskv/go.mod:
    no such file or directory

because src/MAPPINGS/github.com/peterbourgon/diskv points at
src/github.com/peterbourgon/diskv/v3, which does not exist.
golang-github-peterbourgon-diskv-dev 3.0.0-3 installs at
src/github.com/peterbourgon/diskv and its go.mod says
module github.com/peterbourgon/diskv/v3.

The information is already there. The same go.work carries both lines:

  replace github.com/peterbourgon/diskv     => ./src/MAPPINGS/github.com/peterbourgon/diskv
  replace github.com/peterbourgon/diskv/v3  => ./src/github.com/peterbourgon/diskv

The second comes from auto_module_mappings, so dh-go knows where the module
is when it writes the first one. The maintainer mappings loop just does not
ask. _get_go_module_dependencies already resolves a maintainer mapping that
way, so the patch does the same here. It is also sent as
https://salsa.debian.org/go-team/dh-go/-/merge_requests/13

Reproducer, 10 lines of Go and 5 files in debian/, with
golang-github-peterbourgon-diskv-dev as its only real build dependency: a
module that requires the unsuffixed path, the way code written before the
rename does, plus the mapping above in debian/rules.

In a clean sid chroot: with the dh-go 1.71 from the mirror it fails with that
error, and with the patch it is Status successful and the .deb comes out.

Not the same as the two open reports that look like it. #1149023 is the
non-symlink branch of the dummy dependency loop, which writes a replace for a
real directory that holds no go.mod, and its fix is to check for the go.mod
and let the module fall through to the DUMMY section. #1153417 is the symlink
branch of that same loop, which replaces to the directory its target already
uses, and its fix is to go through src/MAPPINGS. This one is the maintainer
mappings loop twenty lines earlier, and its fix is to resolve the replacement
through auto_module_mappings. Three directives in the same function, three
different lines, three different patches. Merge them if you prefer them
together.

Found in the field by the trivy packaging: trivy-kubernetes 0.9.1-2 fails its
autopkgtest this way with 1.71, and works around it by creating
src/github.com/peterbourgon/diskv/v3 itself.
Technical Details
Message-ID: <NXhGy-aG9V-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!srl.newsdeef.eu!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!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: juan.mendezr@proton.me
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153462: dh-go: the DH_GOLANG_MODULE_MAPPINGS symlink points at the module path, not at where the module is installed
Date: Sun, 08 Nov 2026 21:30:02 +0100
Message-ID: <NXhGy-aG9V-5@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Nov  8 20:23:07 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.44
Reply-To: juan.mendezr@proton.me, 1153462@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: juan.mendezr@proton.me, team+pkg-go@tracker.debian.org
X-Debian-Pr-Message: report 1153462
X-Debian-Pr-Package: dh-go
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: dh-go
Feedback-ID: 176548819:user:proton
X-Pm-Message-ID: 9a29245f190589a9c8c145bc1652c6cdf5e799ea
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/2001530
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 68
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sun, 08 Nov 2026 20:20:02 +0000
X-Original-Message-ID: <60c58e570554f0084f944788b5f42ea5@proton.me>