On Fri, Nov 20, 2020 at 2:45 AM Jeremy C. Reed <[email protected]> wrote: > > I have some code that we switched to using golang-1.11-go using stretch > backports (previously was version 1.7 or golang-go on stretch). My > debian/rules has > # set executable path to see the golang-1.11-go install > export PATH := /usr/lib/go-1.11/bin:/usr/bin:/bin > > The new code also introduced a go.mod file. > > Now package building (dh_auto_build -O--buildsystem=golang) fails > with: > > exec: "git": executable file not found in $PATH > > It is trying to fetch code instead of using the dev packages it already > extracted to /usr/share/gocode/src ... > > I changed debian/rules to remove the go.mod and then the package build > is successful. > > Also the switch to newer golang introduce another problem: > > go: disabling cache (/nonexistent/.cache/go-build) due to initialization > failure: mkdir /nonexistent: permission denied > go: cannot use modules with build cache disabled > dh_auto_build: go install -v -p 1 returned exit code 1 > > I worked around that in debian/rules with > export GOCACHE = /tmp/gocache > And target does mkdir -p /tmp/gocache > > Can anyone point me to debian packaging guidelines for packaging with > golang-1.11-go including with using go.mod? > > Is removing go.mod or otherwise telling the build to not use it > acceptable workaround? >
I assume you are building Go packages the debian way, which uses dh-golang. Then you may need a newer dh-golang (>= 1.39), which sets the GO111MODULE env to off. -- Shengjing Zhu
