我还应该声明 GOPATH 吗?
should I still declare GOPATH?
- 我正在阅读 Learning GO 并建议需要在 PATH 上声明
GOPATH="/home/user/go"
.
作者:
it’s a good idea to explicitly define GOPATH and to put the $GOPATH/bin directory in your executable path. Explicitly defining GOPATH makes it clear where your Go workspace is located and adding $GOPATH/bin to your executable path makes it easier to run third-party tools installed via go install.
- 当我 运行
go env
1.18.1 已经声明时,为什么仍然建议在 .bashrc
或 .bash_profile
path
中声明
谢谢
[S]hould I still declare GOPATH, GOROOT?
否且否!
GOPATH 默认为 $HOME/go,这很好,并且基于 GOPATH 的构建已被弃用 年 。使用模块。
GOROOT 从来都不是 Go 最终用户的事情。如果您使用 Go 编译器本身或将 Go 安装在不寻常的位置(最终用户不应该这样做),则必须进行设置。
远离任何宣传 GOPATH 甚至建议搞乱 GOROOT 的资源。
- 我正在阅读 Learning GO 并建议需要在 PATH 上声明
GOPATH="/home/user/go"
.
作者:
it’s a good idea to explicitly define GOPATH and to put the $GOPATH/bin directory in your executable path. Explicitly defining GOPATH makes it clear where your Go workspace is located and adding $GOPATH/bin to your executable path makes it easier to run third-party tools installed via go install.
- 当我 运行
go env
1.18.1 已经声明时,为什么仍然建议在.bashrc
或.bash_profile
path
中声明
谢谢
[S]hould I still declare GOPATH, GOROOT?
否且否!
GOPATH 默认为 $HOME/go,这很好,并且基于 GOPATH 的构建已被弃用 年 。使用模块。
GOROOT 从来都不是 Go 最终用户的事情。如果您使用 Go 编译器本身或将 Go 安装在不寻常的位置(最终用户不应该这样做),则必须进行设置。
远离任何宣传 GOPATH 甚至建议搞乱 GOROOT 的资源。