CentOS7:配置GO环境变量

1.在文件 /etc/profile 末尾添加配置
//在文件末尾添加
vi /etc/profile
//这个是golang安装的位置,根据自己路径填写
export GOROOT=/usr/local/go 
//配置工作路径
export GOPATH=/opt/gopath

如图: 在这里插入图片描述
注:这个文件重新登录生效,如果需要马上生效,请执行以下命令:

source /etc/profile
2.查看是否成功:
[root@izuf63flyho9ngarmrk38sz /]# echo $GOPATH
/opt/gopath

猜你喜欢

转载自blog.csdn.net/weixin_44732379/article/details/108004585