Where does go get $GOPATH from?

blov · · 768 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m trying to install some software and get the following error:</p> <pre><code>maruwan@ubuntu:~$ go get github.com/gorilla/rpc/v2/json2 package github.com/gorilla/rpc/v2/json2: cannot download, $GOPATH not set. For more details see: go help gopath maruwan@ubuntu:~$ echo $GOPATH /home/maruwan/go maruwan@ubuntu:~$ </code></pre> <p>Both my .profile and .bashrc contain these lines:</p> <pre><code>GOPATH=&#34;$HOME/go&#34; # contains bin, src &amp; pkg GOROOT=&#34;$HOME/Stuff/go&#34; # contains go source </code></pre> <p>Can anyone help me debug this?</p> <hr/>**评论:**<br/><br/>maruwan: <pre><p>I figured it out: I neded <code>export GOPATH=...</code></p> <p>I added the <code>export</code> and now it works.</p></pre>jerf: <pre><p>Yes. In one of shell&#39;s many annoyances, there are local variables and exported variables, and virtually no indication which you have when you look.</p></pre>Femaref: <pre><p><code>env</code> access global, <code>set</code> shell variables.</p></pre>

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

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