Subject: bug#25752: go incremental builds broken

From: zimoun <[email-masked]>
Date: Fri, 28 Oct 2022 10:22:38 +0200

Hi,

On Thu, 27 Oct 2022 at 12:21, Maxime Devos <[email-masked]> wrote:

> A reproducer was given in
> <https://issues.guix.gnu.org/25752#0>:
>
> guix environment --ad-hoc go -- bash -c 'export t=$(mktemp -d); cd
> $t && export GOPATH=$(pwd) GOBIN=$(pwd)/bin && go install cmd/go; cd
> && rm -rf $t'

--8<---------------cut here---------------start------------->8---
$ guix shell -C go bash coreutils -- bash -c 'export t=$(mktemp -d); cd $t && export GOPATH=$(pwd) GOBIN=$(pwd)/bin && go install cmd/go; cd && echo $t'
[...]

# runtime/cgo
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in $PATH
/tmp/tmp.srzPbcMLCc

$ guix shell -C go bash coreutils gcc-toolchain -- bash -c 'export t=$(mktemp -d); cd $t && export GOPATH=$(pwd) GOBIN=$(pwd)/bin && go install cmd/go; cd && echo $t'
[...]

go install cmd/go: copying /tmp/go-build1675975230/b001/exe/a.out: open /gnu/store/82adn4rx1h5fc7zms5g0ymwr8dk060nh-go-1.19.1/lib/go/bin/go: read-only file system
/tmp/tmp.qOfxzeZDxH
--8<---------------cut here---------------end--------------->8---

Well, as I am not a Go user, what is the expected result of the command?

Efraim commented:

        I actually spent a bit of time on this today/yesterday. I
        modified the go-build-system to copy the pkg and src folders
        from build to build (instead of just the src folders) and the
        pkg folders were ignored.  Upstream documentation isn't clear
        about when the pkg folder is used and when it is ignored.

        <https://issues.guix.gnu.org/25752#7>

Cheers,
simon