Linux环境安装Golang

命令行安装

yum install golang

默认安装目录/usr/lib/golang/  (不同系统不一样,可通过搜索golang关键字查找: find / -name golang)

卸载

yum remove golang

配置环境变量

手动安装

官网下载安装包:链接

如:wget https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz

解压到  /usr/local/go

配置环境变量

# 打开
vim /etc/profile
# 添加
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
# 编译
source /etc/profile

是否需要配置GOPATH

Go的1.11版本之后,已不再推荐使用GOPATH来构建应用了,使用Module方式构建

posted @ 2020-02-15 18:29  jihite  阅读(11164)  评论(0编辑  收藏  举报