1

golang环境安装

 3 years ago
source link: https://studygolang.com/articles/34367?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
  • golang安装
    • 下载golang软件
    • 解压lang
    • 配置golang
    • 重新导入配置
  • golang配置正确下载资源

golang安装

下载golang软件

  • 【国内网站】https://studygolang.com/dl go语言中文网下载 go最新的安装包,根据不同的系统,可以选择 windows,linux,mac
  • 【可以上外网的话】访问go语言英文网站 https://docs.studygolang.com/doc/install

解压lang

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

配置golang

  • 将go的二进制目录添加到PATH环境变量

    vim /etc/profile
    export GOROOT=/usr/local/go
    export PATH=$PATH:$GOROOT/bin

重新导入配置

source /etc/profile

golang配置正确下载资源

go env -w GO111MODULE=on
 
go env -w GOPROXY=https://goproxy.cn,direct

若出现报错:

warning: go env -w GOPROXY=... does not override conflicting OS environment variable

则直接修改此处,将  https://goproxy.cn,direct  填入如下位置

0cba32e5e988cd76e7761931242104d9.png

以上为本期全部内容,如有疑问可以在评论区或后台提出你的疑问,我们一起交流,一起成长。

好家伙要是文章对你还有点作用的话,请帮忙点个关注,分享到你的朋友圈,分享技术,分享快乐

技术是开放的,我们的心态,更应是开放的。拥抱变化,向阳而生,努力向前行。


有疑问加站长微信联系(非本文作者)

280

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK