[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Multiple import paths for a package seems to not work



On 06/10/2025 18:16, Nilesh Patra wrote:
On 06/10/25 9:36 pm, Nicolas Peugnet wrote:
The documentation of dh_golang [3] indicates that only the *first*
import path is used:
"DH_GOPKG" is automatically set to the value of the first import path of the "XS-Go-Import-Path" "debian/control" field, which can contain several comma-separated import paths.

In your case, riseup-vpn is looking for the Go package
"git.torproject.org/pluggable-transports/snowflake.git/common/encapsulation",
whereas the snowflake one provides only
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/encapsulation/",
which is a different import path.

Yep, I noticed this, but to my understanding DH_GOPKG matters for the package that we are
_currently_ building, IoW, it would matter for riseup-vpn itself as written in docs

https://manpages.debian.org/testing/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html

| "DH_GOPKG" (string) contains the Go package name which this Debian package is building.
| "DH_GOPKG" is automatically set to the value of the first import path of the "XS-Go-Import-Path" "debian/control"
| field, which can contain several comma-separated import paths.

In this case, golang-snowflake-dev is a Build-Depends of riseup-vpn. Does DH_GOPKG also impact the
dependencies?

Sorry, what I wanted to say is that, when golang-snowflake-dev is built, its Go sources files are only put in the DH_GOPKG path, which is the first import path of XS-Go-Import-Path. This is the reason why the Go sources of golang-snowflake-dev are only present in:

  /usr/share/gocode/src/gitlab.torproject.org/...

And not in

  /usr/share/gocode/src/git.torproject.org/...

Shouldn't these be resolved based off all values of XS-Go-Import-Path?

AFAIK the dependencies are resolved at build time by the Go toolchain directly in GOPATH mode [4], using "/usr/share/gocode/" as the value for the GOPATH environment variable. So XS-Go-Import-Path is not involved at this time.

As a matter of fact, this will become problematic once upstream decides to fully remove the GOPATH development mode: https://go.dev/wiki/GOPATH#deprecating-and-removing-gopath-development-mode

[4] https://go.dev/wiki/GOPATH#gopath-development-mode
--
Nicolas Peugnet



Reply to: