Article View: linux.debian.ports.x86-64
Article #4Bug#1151040: dh-golang: Set GOAMD64 based on DEB_HOST_ARCH_VARIANT for microarchitecture builds
From: Sumit Tiwari
Date: Fri, 16 Oct 2026 11:10
Date: Fri, 16 Oct 2026 11:10
47 lines
3933 bytes
3933 bytes
Package: dh-golang
Version: 1.63build1
Severity: wishlist
X-Debbugs-Cc: debian-amd64@lists.debian.org, sumit.tiwari@canonical.com
User: debian-amd64@lists.debian.org
Usertags: amd64
Dear Maintainer,
[Goal]
Enable microarchitecture variant support (like amd64v3) for Go packages built in the archive.
[Problem]
Currently, if a build is triggered with DEB_HOST_ARCH_VARIANT=amd64v3, dpkg-buildflags correctly translates this for bundled C/C++ code.
However, the native Go compiler ignores this and continues to build at the baseline amd64 level.
To actually utilize these optimizations, Go (since 1.18) requires the GOAMD64 environment variable to be set.
[Proposed Solution]
We need dh-golang to act as the bridge. dh-golang should read the DEB_HOST_ARCH_VARIANT environment variable provided by dpkg and explicitly export GOAMD64.
For example, if $ENV{DEB_HOST_ARCH} is amd64 and $ENV{DEB_HOST_ARCH_VARIANT} is amd64v3, dh-golang should extract the v3 and set GOAMD64=v3 in the build environment (provided the package maintainer hasn't already explicitly overridden it).
I am currently putting together a patch for lib/Debian/Debhelper/Buildsystem/golang.pm to implement this and will attach it to this bug report shortly.
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-38-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
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.31ubuntu1
ii libdpkg-perl 1.23.7ubuntu1
ii perl 5.40.1-7ubuntu0.3
dh-golang recommends no packages.
dh-golang suggests no packages.
-- no debconf information
Technical Details
Message-ID:
<NONYZ-5Uly-3@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Sumit Tiwari <sumit.tiwari@canonical.com> Newsgroups: linux.debian.ports.x86-64 Subject: Bug#1151040: dh-golang: Set GOAMD64 based on DEB_HOST_ARCH_VARIANT for microarchitecture builds Date: Fri, 16 Oct 2026 13:10:01 +0200 Message-ID: <NONYZ-5Uly-3@gated-at.bofh.it> X-Mailbox-Line: From debian-amd64-request@lists.debian.org Fri Oct 16 11:01:16 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Amavis-Spam-Status: No, score=-1.651 tagged_above=-10000 required=5.3 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no autolearn_force=no Reply-To: Sumit Tiwari <sumit.tiwari@canonical.com>, 1151040@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: debian-amd64@lists.debian.org, sumit.tiwari@canonical.com, team+pkg-go@tracker.debian.org X-Debian-Pr-Message: report 1151040 X-Debian-Pr-Package: dh-golang X-Debian-Pr-Source: dh-golang Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: reportbug 13.2.0+ubuntu1 X-Mailing-List: <debian-amd64@lists.debian.org> archive/latest/29773 List-ID: <debian-amd64.lists.debian.org> List-URL: <https://lists.debian.org/debian-amd64/> List-Archive: https://lists.debian.org/msgid-search/179214832892.1152399.11924445856407469362.reportbug@thinkpad Approved: robomod@news.nic.it Lines: 47 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Fri, 16 Oct 2026 16:28:49 +0530 X-Original-Message-ID: <179214832892.1152399.11924445856407469362.reportbug@thinkpad>