* Marvin Renich <
mr...@renich.org> [160605 15:48]:
> Perhaps go build and go install by default could add an appropriate
> -trimpath to remove the portion of the path corresponding to the element
> of GOPATH for each compiled file. That should allow reproducible builds
> and keep enough info to find the source file (in most cases).
* Konstantin Khomoutov <
flat...@users.sourceforge.net> [160606 07:35]:
> On the second thought, as support for multiple workspaces means the
> source of each package used to build the resulting executable could
> have been picked from any workspace listed in $GOPATH, any approach
> which blindly uses the value of that variable is fragile (and is
> just incorrect from a theoretical standpoint.)
[I know you were responding to the OP, but even if you weren't alluding
to my msg, I believe the following is relevant.]
First, I am not a reproducible-builds enthusiast, but I know that, at
least in the Debian community, there is an active and growing effort to
support reproducible builds, and they have some significant benefits,
which is why I made my suggestion.
From a theoretical standpoint, removing GOPATH elements loses
information, but it is not "incorrect". Even the current situation does
not give complete enough information to uniquely identify the exact
source used, such as the machine on which the source was built or the
current SC revision checked out.
From the standpoint of reproducible builds, however, it is expected that
the executable is built from publicly available source, which means the
import path, and thus the part of the file name remaining after removing
GOPATH elements, is unique enough, and just as informative as the
current full path.
The go tools are not the Go language, and don't need to be
"theoretically perfect". The defaults should be what works best in most
situations, as long as there is a way to override those defaults. In
most realistic situations that do not involve reproducible builds,
removing leading GOPATH elements will not cause any problem, but for
reproducible builds, doing so has significant benefits. This is why I
believe my suggestion is worth consideration.
Reproducible builds are not important enough to me to continue to
champion this suggestion if there is opposition to it, but I didn't want
it dismissed as "fragile" (which is not true in a realistic build
environment) or "incorrect" (which is simply, ah, incorrect). (And,
yes, I have two elements in my GOPATH.)
...Marvin