英文:
$GOPATH value keeps reseting to empty during new sessions of the terminal
问题
我在我的Mac Book上使用golang.org的10.8+安装程序安装了GO,并设置了一个工作空间。在运行了这两个命令后:export GOPATH=$HOME/go
和export PATH=$PATH:$GOPATH/bin
,回显GOPATH确实返回了/Users/dipen/go
的值;然而,在重新启动终端后,回显GOPATH没有返回任何内容。我该如何解决这个问题?
英文:
I have installed GO on my Mac Book using the 10.8+ installer from golang.org, and I have set up a workspace. After running both these commands: export GOPATH=$HOME/go
and export PATH=$PATH:$GOPATH/bin
, echoing the GOPATH does return a value of /Users/dipen/go
; however, after restarting the terminal, the echoing the GOPATH returns nothing. How can I fix this?
答案1
得分: 2
请将以下内容添加到您的 ~/.bashrc 或 ~/.bash_profile 文件中:
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
英文:
Add these lines to your ~/.bashrc or ~/.bash_profile:
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论