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

Re: GO111MODULE=on and "go: cannot use modules with build cache disabled"



You can set GOPROXY=off to prevent the go tool from using the network (we should do this in dh-golang).

Note that building a program using modules currently requires the go.mod files of all dependencies (in all versions mentioned in the transitive dependency closure!) to be present. They can partly be synthesized, and most likely, synthesizing them in your package is the route of least resistance for now. See https://github.com/golang/go/issues/29410 for details.

On Tue, Feb 26, 2019 at 3:09 PM Julian Gilbey <julian-pkggo@d-and-j.net> wrote:
On Tue, Feb 26, 2019 at 11:20:00AM +0100, Michael Stapelberg wrote:
> My guess is that you need to set GOCACHE to a temporary directory. This should
> be done within dh-golang itself, so please send a patch.
> I think you’re treading on unchartered territory here — I’m not aware of any
> package within Debian using Go modules yet.

Thanks Michael!

I tried manually creating a temporary directory and setting GOCACHE to
point to it.  That was successful, though it gave the following
output, which is significantly different in format from what I have
seen before with other builds:

[...]
   dh_auto_build -O--buildsystem=golang
go: finding github.com/rsteube/cobra v0.0.1-zsh-completion-custom
go: finding github.com/rivo/tview v0.0.0-20180419193403-f855bee0205c
[...]
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
warning: ignoring symlink /home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src/cloud.google.com
[... many more similar warnings ...]
go: downloading github.com/xanzy/go-gitlab v0.12.3-0.20181228114601-7bc4155e8bf8
go: downloading github.com/rsteube/cobra v0.0.1-zsh-completion-custom
[... lots more downloading lines ...]
warning: ignoring symlink /home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src/cloud.google.com
[... many more similar warnings ...]
go: finding github.com/spf13/cobra v0.0.0-20180412120829-615425954c3b
can't load package: package github.com/zaquestion/lab/obj-x86_64-linux-gnu/pkg/mod/github.com/avast/retry-go@v0.0.0-20180319101611-5469272a8171: can only use path@version syntax with 'go get'
[... lots more "can't load package" errors ...]
        cd obj-x86_64-linux-gnu && go install -gcflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\" -asmflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\" -v -p 4 github.com/zaquestion/lab github.com/zaquestion/lab/cmd github.com/zaquestion/lab/docs github.com/zaquestion/lab/internal/browser github.com/zaquestion/lab/internal/config github.com/zaquestion/lab/internal/copy github.com/zaquestion/lab/internal/git github.com/zaquestion/lab/internal/gitlab
internal/race

errors
[...]

and then it goes on to complete the build with no problems.

Hmm, it does seem as though it is actively downloading packages from
the internet with the settings:

export GO111MODULE := on
export GOCACHE := /tmp/tmp.X9n0iu3c3b

That's not good.  :/

Any ideas?  The current package is at
salsa.debian.org:go-team/packages/git-lab.git
(though it is broken when it downloads packages directly: the patch
update-for-new-tview.patch needs to be removed).  There are also other
issues with this package, but they are unrelated.

Best wishes,

   Julian

> On Tue, Feb 26, 2019 at 11:08 AM Julian Gilbey <julian-pkggo@d-and-j.net> wrote:
>
>   Hi!
>
>   I'm trying to build a Go package which requires GO111MODULE=on.  So I
>   set
>
>   export GO111MODULE := on
>
>   in the debian/rules Makefile (after reading
>   /usr/share/perl5/Debian/Debhelper/Buildsystem/golang.pm - it wasn't
>   obvious how to set this otherwise).  But now the build bombs out very
>   quickly indeed:
>
>      [...]
>      dh_auto_build -O--buildsystem=golang
>   go: cannot use modules with build cache disabled
>           cd obj-x86_64-linux-gnu && go install
>   -gcflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\"
>   -asmflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\"
>   -v -p 4
>   go: cannot use modules with build cache disabled
>   dh_auto_build: cd obj-x86_64-linux-gnu && go install
>   -gcflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\"
>   -asmflags=all=\"-trimpath=/home/jdg/debian/go-gitlab/build-area/git-lab-0.15.2/obj-x86_64-linux-gnu/src\"
>   -v -p 4 returned exit code 1
>   make: *** [debian/rules:9: build] Error 1
>
>   Help?!  How do I use GO111MODULE=on and not have the build crash like
>   this?
>
>   Thanks,
>
>      Julian
>
> --
> Best regards,
> Michael


--
Best regards,
Michael

Reply to: