go env GOPATH should default to $HOME/go if it exists, but at my end it just doesn't

agolangf · · 456 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Any ideas? I&#39;m on a fresh Fedora install and just did <code>sudo dnf install golang</code> (installs 1.7.5) while $HOME/go <em>does</em> exist with proper bin/pkg/src directories. Restarted too. But unlike <a href="https://golang.org/doc/code.html#GOPATH">described here</a>, <code>go env</code> shows an empty string for GOPATH!</p> <p>This fully worked as documented on my previous system (same OS &amp; versions etc) so I&#39;m at a loss why it wouldn&#39;t on this one. Haven&#39;t done any whack shell-script tweaks anywhere either (yet).</p> <p>Sure, I could set it but I actually I have written some tooling relying on <code>go env GOPATH</code> working as advertised whenever there is a proper <code>go</code> tree in $HOME --- so I&#39;m <em>doubly</em> curious under what circumstances it wouldn&#39;t.</p> <hr/>**评论:**<br/><br/>dlq84: <pre><p>It does in 1.8, not with earlier versions.</p></pre>meta_leap: <pre><p>Ahh crikey, in that case I remembered things wrongly about my previous setup. I was sure I had tested the described behavior under that version and found it working, but apparently it&#39;s time to start a proper diary =)</p></pre>dlq84: <pre><p>I suggest you wait for 1.8.1, it should be right around the corner. 1.8 have some potentially nasty bugs. <a href="https://github.com/golang/go/issues?q=is%3Aclosed+milestone%3AGo1.8.1" rel="nofollow">https://github.com/golang/go/issues?q=is%3Aclosed+milestone%3AGo1.8.1</a></p></pre>shovelpost: <pre><p>As far as I know, GOPATH default to ~/go was added in go 1.8.</p></pre>danredux: <pre><p>FYI, as far as I know, go does not SET the env variable. It just tests for it&#39;s presence, falling back to $HOME/go if it&#39;s not set.</p></pre>meta_leap: <pre><p>Yeah I assumed as much in my OP</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

456 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传