一、安装Go
1、下载Go安装包
下载地址:https://studygolang.com/dl,注意选择windows版本,国内需要梯子

2、安装
双击安装包,点击Next,直至完成安装。这里需要注意的是,安装路径可以自己选择,例如:D:\dev\Go
3、设置GOPATH工作目录
在D盘新建 gopath 文件夹,则 gopath 的路径就为:D:\gopath
同时,需要在 gopath 下新建 bin、pkg、src 这三个文件夹
4、环境变量配置
此电脑(右击) ======> 属性 ======> 高级系统设置 ======> 环境变量,将系统变量中的 GOAPTH 这一项路径修改为 D:\gopath,同时在用户变量中添加GOPATH变量
5、验证
打开 CMD 命令窗口,输入 go version,若返回版本号则说明 Go 安装成功

接下来再输入 go env,看返回结果中的 GOAPTH 和 GOROOT 是否正确,请注意,GOROOT是你安装GO的目录

6、修改GOPROXY
由于默认的 goproxy 地址被墙挡住了,无法访问,所以需要修改 GOPROXY 变量。打开 CMD 命令窗口,执行以下命令
go修改阿里云源
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
阿里云
配置如下:
export GOPROXY=https://mirrors.aliyun.com/goproxy/
nexus社区提供的
配置如下:
export GOPROXY=https://gonexus.dev
goproxy.io 的
配置如下:
export GOPROXY=https://goproxy.io/
基于athens的公共服务
配置如下:
export GOPROXY=https://athens.azurefd.net
官方提供的(jfrog,golang)
export GOPROXY=https://gocenter.io
export GOPROXY=https://proxy.golang.org
七牛云赞助支持的
export GOPROXY=https://goproxy.cn
此时,再次执行 go env 命令就会发现 GOPROXY 变量的值已被修改,具体如上图所示。
二、安装并配置Goland
1、下载Goland
下载地址:https://www.jetbrains.com/go/download/other.html

2、安装Goland
双击安装文件,执行安装,注意勾选下面安装项,安装路径可自行选择
例如:D:\Program Files\JetBrains\GoLand 2020.2.3

3、激活
这一步就八仙过海各显神通了
4、配置Goland
打开Goland后,依次点击 File ======> Settings ======> Go,设置 GOROOT 和 GOAPTH,这里 GOROOT 和 GOPATH 设置的路径需要和 go env 中的 GOROOT、GOPATH 路径一致即可,如下图所示


至此,Goalnd 设置完毕,下面就可以打开 Goland 愉快的 coding 了!
无论从事什么行业,只要做好两件事就够了,一个是你的专业、一个是你的人品,专业决定了你的存在,人品决定了你的人脉,剩下的就是坚持,用善良專業和真诚赢取更多的信任。