修改~/.bash_profile 后 source .bash_profile
go env 可以看到 gopath 是我设置在 bash_profile 的位置,但是关闭 shell 再打开 shell,go env 又变回原来的位置。
~ 下面只有.bash_profle,没有.zshrc
希望大神帮忙解答
修改~/.bash_profile 后 source .bash_profile
go env 可以看到 gopath 是我设置在 bash_profile 的位置,但是关闭 shell 再打开 shell,go env 又变回原来的位置。
~ 下面只有.bash_profle,没有.zshrc
希望大神帮忙解答
|
yangkghjhMay 21, 2020
1
/etc/profile
如果你无法确定 bash 配置文件的加载顺序的话 |
|
2
这是 /etc/profile 内容
# System-wide .profile for sh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi |
|
hanjingzhanMay 21, 2020 via Android
3
brew 直接下?
|
|
4
@hanjingzhan 官网下 dmg 安装的
|
|
VegetableMay 21, 2020
5
看起来是因为加载顺序与预期不符造成的,之前的 GOPATH 你没有移除,覆盖了你修改的 GOPATH 。建议你找到之前的变量位置。
ls -la|grep -v ^d|grep "\."|awk '{print $9}'|xargs cat|grep GOPATH 看一下是不是有多处 |
|
charlie21May 21, 2020
6
你的 shell 是 bash 还是 zsh 阿
|
|
youxiachaiMay 22, 2020
7
mac 10.15 用 zsh.. 没有 zshrc 自己建一个吧。。
|
|
aladdindingdingMay 22, 2020
8
看你的 shell 是 zsh 还是 bash 了
|
|
amareMay 22, 2020
9
which go, 应该是被覆盖掉了,删了就好。
|
|
hongxi2200May 22, 2020
10
用的是 GoLand 里的 terminal 吗?
听上去像,因为我在 GoLand 的 terminal 里修改过 GOPROXY 在重新打开 terminal 的时候的确也出现了被恢复原样的情况。 可能是 GoLand 的项目设置控制着 go env |
|
dafsicMay 22, 2020
11
相信我,关机,重启就好了
|
|
12
@youxiachai 是这个原因,谢谢
|