guix-devel
[Top][All Lists]
Advanced

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

Re: Packaging gx (for IPFS): Need to update default Go to 1.11?


From: Pierre Neidhardt
Subject: Re: Packaging gx (for IPFS): Need to update default Go to 1.11?
Date: Sun, 11 Nov 2018 17:43:33 +0100
User-agent: mu4e 1.0; emacs 26.1

I've been studying the situation:

From https://golang.org/doc/go1.10#build:

> The go build command now maintains a cache of recently built packages,
> separate from the installed packages in $GOROOT/pkg or $GOPATH/pkg. The effect
> of the cache should be to speed builds that do not explicitly install packages
> or when switching between different copies of source code (for example, when
> changing back and forth between different branches in a version control 
> system).

From https://golang.org/doc/go1.11:

> Go 1.11 will be the last release to support setting the environment variable
> GOCACHE=off to disable the build cache, introduced in Go 1.10. Starting in Go
> 1.12, the build cache will be required, as a step toward eliminating
> $GOPATH/pkg. The module and package loading support described above already
> require that the build cache be enabled

My understanding is that we cannot rely on the /pkg/ folder anymore, since Go
1.12 won't use it at all.

We could maintain a store-level Go cache, but I'm not sure that's doable and I
don't think it makes much sense.  Without a cache, it seems that it's
effectively impossible to re-use pre-built libraries when building Go packages.
From the user perspective, this would not be a big deal because the cache can be
used in this context.  Only the first build would be slower.

More importantly, that would mean that we no longer need to build Go libraries:
we should simply ship the source code in /src/.  The upside is that it saves
space in the store and makes for smaller substitutes.

For the other issue with flag forwarding, there might be a better solution. 
From https://golang.org/doc/go1.10#build:

> The go build -asmflags, -gcflags, -gccgoflags, and -ldflags options now apply 
> by
> default only to the packages listed directly on the command line. For example,
> go build -gcflags=-m mypkg passes the compiler the -m flag when building mypkg
> but not its dependencies. The new, more general form -asmflags=pattern=flags
> (and similarly for the others) applies the flags only to the packages matching
> the pattern. For example: go install -ldflags=cmd/gofmt=-X=main.version=1.2.3
> cmd/... installs all the commands matching cmd/... but only applies the -X
> option to the linker flags for cmd/gofmt. For more details, see go help build.

I think it does not work for "-tags" however.  So we need to ask golua's
maintainer if there is a solution to build golua differently.
If not, then the best solution I can think of is to patch golua to build with
lua5.3 by default.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]