Mac终端更改go环境变量出现问题
- 显示没有权限去修改
- 问题截图

-
- 解决方式
a.更新指令:source ~/.bash_profile
b.若无效出现新问题(忘截图了)
第一行为Found a swap file by the name "~/.bash_profile.swp"
最后一行为[O]penRead-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
输入指令:rm -f ~/.bash_profile.swp
c.再次输入:vim ~/.bash_profile
d.保存退出「:wq」
e.再次执行更新指令:source ~/.bash_profile
-
- 出现原因
在网上找发现是因为在这次vim操作前应该是有过一次使用vim 操作bash_profile文件时出现了异常退出,所以在当前目录下产生了一个.bash_profile.swp交换文件,我们可以使用「R」键或者是「vi -r filename」来恢复文件,然后将该交换文件删除。
- 在GoLand中使用github上的库标红
在go的配置文件bash_profile中加入一行环境变量,重新打开
「export GOPROXY="https://goproxy.cn,direct"」

浙公网安备 33010602011771号