Package: dh-go Version: 1.71 Severity: important Tags: patch X-Debbugs-Cc: [email protected]
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/[email protected]+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.

