SDK

image.png

  1. 官网: [https://golang.org/](https://golang.org/)
  2. SDK选择:
  3. ![image.png](https://cdn.nlark.com/yuque/0/2021/png/22899296/1634108148155-68b9aa9c-f6c3-4b17-8ff3-a876933ba2d0.png#clientId=u6b736b23-6750-4&from=paste&height=390&id=uefe461b7&margin=%5Bobject%20Object%5D&name=image.png&originHeight=587&originWidth=903&originalType=binary&ratio=1&size=378141&status=done&style=none&taskId=u2c847973-9027-466a-949b-70f7e4feefd&width=600.5)

Windows环境

image.png

配置环境变量

  1. ![image.png](https://cdn.nlark.com/yuque/0/2021/png/22899296/1634108177387-a12ebe57-88ec-4eab-b720-4377c2078b87.png#clientId=u6b736b23-6750-4&from=paste&height=102&id=u5fe7b8ea&margin=%5Bobject%20Object%5D&name=image.png&originHeight=117&originWidth=657&originalType=binary&ratio=1&size=41808&status=done&style=none&taskId=u03674115-f2e2-47fe-bd4b-b7b032e65e0&width=570.5)

image.png

  1. 1. 新建系统变量 GOROOT - SDK安装目录
  2. 2. Path添加路径 %GOROOT%\bin
  3. 3. 新建系统变量 GOPATH - go项目workspace

Linux环境配置

image.png

  1. uname -a 64位通常含有64

配置环境变量

  1. 下载后解压复制到存放的目录
  1. sudo vim /etc/profile

按i进去编辑模式,尾部添加如下

  1. export GOROOT=SDK路径
  2. export PATH=$PATH:$GOROOT/bin
  3. export GOPATH=$HOME/goProgect (go项目路径)

按esc退出编辑,输入:wq 保存

最后

  1. source /etc/profile

立即生效

(如果不能生效注销当前用户,重新登录)

Mac环境

类似Linux

image.png

测试

  1. go version