失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > linux卸载rpm安装的golang linux下go安装/卸载重装-Go语言中文社区

linux卸载rpm安装的golang linux下go安装/卸载重装-Go语言中文社区

时间:2021-12-16 09:10:16

相关推荐

linux卸载rpm安装的golang linux下go安装/卸载重装-Go语言中文社区

go安装

下载

首先,在官网下载最新版本官网download

选择linux,进入下载页面下载

根据页面的安装指引,将go文件夹解压到/usr/local/文件夹下

tar -C /usr/local -xzf go1.12.7.linux-amd64.tar.gz

配置环境变量:

将 /usr/local/go/bin 添加到Path的环境变量里

修改/etc/profile文件

添加

export GOROOT=/usr/local/go

export GOPATH=/data/cuteFiles/go

export PATH=$PATH:$GOROOT/bin

执行go env就可以查看go的一些参数

可以自己写一个小代码运行测试一下

go卸载重装(升级版本)

跟go安装的区别就是,需要卸载。

可以执行go env查看GOROOT

我这里GOROOT=/usr/local/go,进入/usr/local,删除go文件夹

命令:sudo rm -rf /usr/local/go

官网原话:

[1]To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go under Linux, macOS, and FreeBSD or c:Go under Windows.

[2]You should also remove the Go bin directory from your PATH environment variable. Under Linux and FreeBSD you should edit /etc/profile or $HOME/.profile. If you installed Go with the macOS package then you should remove the /etc/paths.d/go file. Windows users should read the section about setting environment variables under Windows.

因为要重装的话,就不需要将GOROOT/bin从path里删除了,还省去了配置/etc/profile,但前提是新安装的go路径可卸载之前的一样

如果觉得《linux卸载rpm安装的golang linux下go安装/卸载重装-Go语言中文社区》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。