When building Bridge v3, the process downloads Go module dependencies into the default Go path, often $HOME/go.
This is not optimal as it creates a seemingly "random" additional directory under the current user's Home. One then needs to remove it manually after compilation which is not "easily" done as Go, by default, makes the module cache read-only and either the permissions need to be adjusted before deletion or it needs to be deleted via sudo or root.
While it makes sense to keep/cache the downloaded dependencies, it should not be done under the default $GOPATH.
Explicitly declaring GOPATH, e.g. GOPATH=$(pwd)/go make build-nogui, correctly downloads the dependencies to go/, a new directory within the bridge local repo.
Expected Behavior
Any downloaded Go dependencies should be pulled into the build working directory;
make clean should remove all downloaded dependencies from the module cache;
Current Behavior
Compile dependencies downloaded to default value of GOPATH as returned by $ go env GOPATH, often $HOME/go;
Possible Solution
Makefile explicitly sets $GOPATH to a directory within the build environment, e.g. GOPATH=$(pwd)/go
Extend make clean or add conventional make distclean rule to remove everything, including above directory of cached modules
Optionally, add -modcacherw to GOFLAGS to make the module cache directory read-write and easily removable
Steps to Reproduce
Make sure there the directory returned by $ go env GOPATH is empty or doesn't exist
Checkout any Bridge v3
Run $ make build-nogui
Go dependencies downloaded to $GOPATH as returned by step 1
Run $ make clean
Downloaded dependencies remain in $GOPATH as returned by step 1
Version Information
Bridge v3.0.12, but also observed in earlier v3 releases.
Six months later, with several releases and many fixes, this nuisance is still a thing. How? Guys, this is a trivial fix it would take a proactive developer less than a minute to resolve.
When building Bridge v3, the process downloads Go module dependencies into the default Go path, often
$HOME/go
.This is not optimal as it creates a seemingly "random" additional directory under the current user's Home. One then needs to remove it manually after compilation which is not "easily" done as Go, by default, makes the module cache read-only and either the permissions need to be adjusted before deletion or it needs to be deleted via
sudo
orroot
.While it makes sense to keep/cache the downloaded dependencies, it should not be done under the default
$GOPATH
.Explicitly declaring
GOPATH
, e.g.GOPATH=$(pwd)/go make build-nogui
, correctly downloads the dependencies togo/
, a new directory within the bridge local repo.Expected Behavior
make clean
should remove all downloaded dependencies from the module cache;Current Behavior
GOPATH
as returned by$ go env GOPATH
, often$HOME/go
;Possible Solution
Makefile
explicitly sets$GOPATH
to a directory within the build environment, e.g.GOPATH=$(pwd)/go
make clean
or add conventionalmake distclean
rule to remove everything, including above directory of cached modules-modcacherw
toGOFLAGS
to make the module cache directory read-write and easily removableSteps to Reproduce
$ go env GOPATH
is empty or doesn't exist$ make build-nogui
$GOPATH
as returned by step 1$ make clean
$GOPATH
as returned by step 1Version Information
Bridge v3.0.12, but also observed in earlier v3 releases.