From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: bug#30287: Go compiler tries writing to the store Date: Mon, 29 Jan 2018 16:39:05 -0500 Message-ID: <20180129213905.GB8542@jasmine.lan> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egH9r-0001Xm-5s for bug-guix@gnu.org; Mon, 29 Jan 2018 16:40:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egH9o-00038w-26 for bug-guix@gnu.org; Mon, 29 Jan 2018 16:40:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:40373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1egH9n-00038q-Tm for bug-guix@gnu.org; Mon, 29 Jan 2018 16:40:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1egH9n-000819-K0 for bug-guix@gnu.org; Mon, 29 Jan 2018 16:40:03 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egH8w-0001RJ-M5 for bug-guix@gnu.org; Mon, 29 Jan 2018 16:39:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egH8t-0002mX-Hb for bug-guix@gnu.org; Mon, 29 Jan 2018 16:39:10 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41169) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1egH8t-0002mP-CU for bug-guix@gnu.org; Mon, 29 Jan 2018 16:39:07 -0500 Content-Disposition: inline In-Reply-To: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Peter Mikkelsen Cc: 30287@debbugs.gnu.org --gatW/ieO32f1wygP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 29, 2018 at 10:50:10AM +0100, Peter Mikkelsen wrote: > Hi guix, Hi, thanks for this report! I saw your brief conversation on #guix with civodul. Unfortunately I've only been paying attention to packaging Go software with Guix, so I didn't notice this issue. > For example, after setting the environment variable GOPATH to > /home/peter/go, and creating a small hello world program in there, I > would normally be able to run 'go install' in that folder, and the > hello world binary would end up in my gopath. But on guixSD this is > not the case, since it seems like 'go install' is trying to compile > every single library provided by to go package itself, and that means > writing to the store, which is not possible. This is definitely a problem that we need to fix. However, I'm not sure where to start... I'll try debugging by checking if this works on Nix, and seeing what they do differently. > So my question is: Is there a way to prevent 'go install' compiling > things in the store, maybe by pre-compiling during installation of the > go package? Or is there another preferred way to develop go > applications on guix, since what i do now is 'go build', but that gets > really slow with larger projects, at it recompiles everything > everytime if i understand it right. The compiler should never try to write to the store; something is wrong with how we build it. Changing the subject slightly, yes, `go build` always recompiles some things: In general, for Go libraries (they call them "packages"), `go build` always discards the compiled objects. You have to use `go install` to retain them and achieve a caching speedup. For Go executable programs (called "commands"), `go build` does keep the compiled executable. To quote the docs [0]: "Build compiles the packages named by the import paths, along with their dependencies, but it does not install the results. [...] When compiling multiple packages or a single non-main package, build compiles the packages but discards the resulting object, serving only as a check that the packages can be built." https://golang.org/cmd/go/ --gatW/ieO32f1wygP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlpvlHkACgkQJkb6MLrK fwgZ0w/+JAo3Hfy3D+VKjXYcg896DSk5suh0Tezp7hznMdTq64yeMlDiY2B9W4kR ooBa4R5AOB08f80+zsXT2755IaSgRnPhVhlMQk3XECUGN4Gq93QHd6mDnfVQDP38 xV3hk1AEi7wblWwvvB4z5vPMPFH2MVPG5RCs8Y4Jl1myB1Mz7IHV6V5JEk4pEmaP 43hXUgUlLwiK6HNRbPw33TCjM9RLenE6hEeDxwJ49zwTHFI5pjPjCo/EI1af8iiz 2ZwVmLjPYgUm3rk4B4lywEDQAXoVkuElZ0TmY9LEnKqEaVSBJ/LCnj5ztYYmu0Ja QeJMe6hqlADHcLXxVPVJfOIvMpdeeIBw8vYa1vlxvLYyLE1nzk2UubjLXU6QO6U7 HY4lNLblluVnJrsAm9P3nuK4K0myc6VkWQk5YAOoi/0cpt+Fp4nLWn9dDSwaLAv3 1fvsW6oDEknFGiupQn9w2wj9DOTNuj4Dhkuit5qKWfYH8JYq6MpwmsjBImEPERIG pdNRCKz0HJAncs12eju2oz/ihIM3NAXdLdvRR5ELHbQk4OHOZwUgTWtc+DN1pVDC /MJWfFZVr706tqdfJGXYT1npmOEd6g4Bo6XA21mOa2KszDW49A8vL/BK5ngyoHQJ vytjUn7dPD8Mh67f/W+baXJx4MjkyqT/V8gGrMC1ebj219/EbWc= =ZVLo -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--