$GOPATH的值在新的终端会话期间一直重置为空。

huangapple go评论73阅读模式
英文:

$GOPATH value keeps reseting to empty during new sessions of the terminal

问题

我在我的Mac Book上使用golang.org的10.8+安装程序安装了GO,并设置了一个工作空间。在运行了这两个命令后:export GOPATH=$HOME/goexport 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

huangapple
  • 本文由 发表于 2015年1月18日 09:30:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/28006265.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定