On 20/03/2025 18:13, Otto Kekäläinen wrote:
Hi, I am currently drafting the packaging of usql at https://salsa.debian.org/go-team/packages/usql/-/merge_requests/1 It has in go.mod a massive list of requires, mainly because it has support for so many database drivers. I am not interested in packaging all of them, and I see that e.g. in Arch the maintainer limited the build by passing custom tags to 'go build' (https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=usql). This does not work in Debian as dh_golang will always try to include and build everything before starting 'go build'. I also tried limiting the scope with having just a subset of Go project paths in DH_GOLANG_BUILDPKG, which does the first 'go install' run with a smaller scope, but the next step want's to build everything anyway. Any suggestions on what to try next?
You can exclude paths with `export DH_GOLANG_EXCLUDES` [1]To fine tune specific files, you can patch the files to skip with "//go:build ignore" and then don't pass any tag to any of the dh commands.
I had the same issue with dh_golang in ntfy [2] and adding the 'ignore' tag and not passing it will work when dh_golang calls `go list` without the tag.
Build log at https://salsa.debian.org/go-team/packages/usql/-/jobs/7283520 Error output for context:
[...]
src/github.com/xo/usql/run.go:14:2: cannot find package "github.com/go-git/go-billy/v5" in any of: /usr/lib/go-1.24/src/github.com/go-git/go-billy/v5 (from $GOROOT) /tmp/test/usql/debian/build/src/github.com/go-git/go-billy/v5 (from $GOPATH)
[...]However, `run.go` is choking on several missing imports, those have to be patched out if they don't exist in debian.
Here is a painful example of patching out stripe imports: [3]1. https://salsa.debian.org/go-team/packages/ntfy/-/blob/debian/latest/debian/rules?ref_type=heads
2. https://salsa.debian.org/go-team/packages/ntfy/-/blob/debian/latest/debian/patches/3-disable-missing-depends.patch?ref_type=heads
3. https://salsa.debian.org/go-team/packages/ntfy/-/blob/debian/latest/debian/patches/2-disable-stripe.patch?ref_type=heads
-- Regards, Ahmad