unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Famulari <leo@famulari.name>
To: Peter Mikkelsen <petermikkelsen10@gmail.com>
Cc: 30287@debbugs.gnu.org
Subject: bug#30287: Go compiler tries writing to the store
Date: Mon, 29 Jan 2018 16:39:05 -0500	[thread overview]
Message-ID: <20180129213905.GB8542@jasmine.lan> (raw)
In-Reply-To: <CADh9keUd2=WuQoY55rYKUFtkbpymMP2YxRFDaJ=oifdZCOQcrw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]

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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

       reply	other threads:[~2018-01-29 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CADh9keUd2=WuQoY55rYKUFtkbpymMP2YxRFDaJ=oifdZCOQcrw@mail.gmail.com>
2018-01-29 21:39 ` Leo Famulari [this message]
2021-07-03 22:35   ` bug#30287: Go compiler tries writing to the store Sarah Morgensen via Bug reports for GNU Guix
2021-07-25  0:17     ` Sarah Morgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180129213905.GB8542@jasmine.lan \
    --to=leo@famulari.name \
    --cc=30287@debbugs.gnu.org \
    --cc=petermikkelsen10@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).