<p>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.</p>
<hr/>**评论:**<br/><br/>dlsniper: <pre><p>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).</p></pre>10F1: <pre><p>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.</p></pre>mouthBeard: <pre><p>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:</p>
<pre><code>export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
</code></pre>
<p>that way, any binaries that get installed with <code>go get</code> endup in my path if my current gopath is this default gopath.</p></pre>joefitzgerald: <pre><p>There is not an assumption that you have a default <code>GOPATH</code>. There is an assumption that you have the various tools available <em>either</em> in:</p>
<ul>
<li><code>$GOPATH/bin</code> (using the first <code>$GOPATH</code> segment)</li>
<li>Any of your <code>$PATH</code> segments</li>
</ul>
<p><a href="/u/eveilslayer" rel="nofollow">/u/eveilslayer</a> could work around this issue in a few ways:</p>
<ul>
<li>Manually <a href="https://github.com/joefitzgerald/go-plus/blob/4270e4b5c8fbae751243cdea49d77fa60effdc99/lib/package-manager.js#L27-L37" rel="nofollow">go get all the required tools</a> and ensure the resulting binaries are available on the PATH</li>
<li>Create a tools GOPATH (e.g. <code>~/tools</code>), add its <code>bin</code> directory to the PATH, launch atom via <code>GOPATH=~/tools atom .</code>, let go-plus fetch all the tools</li>
</ul>
<p>Either of these approaches will suppress the behavior you are seeing when subsequently launching <code>GOPATH=~/project-1 atom .</code>, <code>GOPATH=~/project-2 atom .</code>, etc.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传