If anyone out there could help me solve this dilemma I would be grateful. Go-plus consistently puts a golang.org and github.com directory in every single project I change my gopath too and also fills my binaries folder up. This is incredibly irritating and it does not do this to my colleges. Need help.
评论:
dlsniper:
10F1:Atom does that because it needs to have access to the go tools that it downloads. My guess is that if you take those binaries from GOPATH/bin and put them somewhere in your PATH where they are not affected by your GOPATH per project model, then this will stop happening (but I'm not familiar with Atom, just an educated guess).
mouthBeard:They recently fixed that in the vscode-go plugin, it was annoying as hell, now there's an option to set a specific path for the tools.
joefitzgerald:I think the assumption the plugin is making is that you have a default GOPATH who's bin directory is also in your PATH. For me, this translates to this being at the end of my ~/.profile:
export GOPATH="$HOME/go" export PATH="$GOPATH/bin:$PATH"
that way, any binaries that get installed with
go get
endup in my path if my current gopath is this default gopath.
There is not an assumption that you have a default
GOPATH
. There is an assumption that you have the various tools available either in:
$GOPATH/bin
(using the first$GOPATH
segment)- Any of your
$PATH
segments
/u/eveilslayer could work around this issue in a few ways:
- Manually go get all the required tools and ensure the resulting binaries are available on the PATH
- Create a tools GOPATH (e.g.
~/tools
), add itsbin
directory to the PATH, launch atom viaGOPATH=~/tools atom .
, let go-plus fetch all the tools
Either of these approaches will suppress the behavior you are seeing when subsequently launching GOPATH=~/project-1 atom .
, GOPATH=~/project-2 atom .
, etc.
