I noticed that Go executables built with the go-build-system keep an unnecessary reference to Go itself:
$ guix gc --references $(realpath $(which syncthing)) /gnu/store/3h31zsqxjjg52da5gp3qmhkh4x8klhah-glibc-2.25 /gnu/store/bqlmgk6ngyi4pivnqpxma2wr5pj5mhkk-gcc-5.4.0-lib /gnu/store/bzj472nmnnj5hcfd5yvfiqip1wzw84p9-tzdata-2017b /gnu/store/qydgxm0sipn4bn5122a3zxiz1bz0vvnw-go-1.9.2 /gnu/store/z1lii251cy0y660910hsfc55cy82dk9i-net-base-5.3 The programs don't need or use this reference, so it would be nice to get rid of it and save users some bandwidth when installing Go programs. I'm still figuring out the best way to approach this issue (Go compiler flags?), but here is some research. In Nixpkgs, there is a switch to disallow this reference specifically: ------ # Do not enable this without good reason # IE: programs coupled with the compiler , allowGoReference ? false ------ https://github.com/NixOS/nixpkgs/blob/39cd40f7bea40116ecb756d46a687bfd0d2e550e/pkgs/development/go-modules/generic/default.nix#L29 ... and it ends in a call to a general-purpose shell script, remove-references-to, which uses sed to remove specific references: https://github.com/NixOS/nixpkgs/blob/39cd40f7bea40116ecb756d46a687bfd0d2e550e/pkgs/build-support/remove-references-to/default.nix I see that in Guix we have ((guix build utils) remove-store-references), which removes *all* store references from a file, but using it here leaves the Go executable unable to even start execution. I think it needs libc's linker: ------ % strace -s1000 -f ./syncthing execve("./syncthing", ["./syncthing"], [/* 42 vars */]) = -1 ENOENT (No such file or directory) fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0 write(2, "strace: exec: No such file or directory\n", 40strace: exec: No such file or directory ) = 40 getpid() = 5493 exit_group(1) = ? +++ exited with 1 +++ ------
signature.asc
Description: PGP signature