1. Windows 安装
- 访问 https://golang.org/dl/
- 下载
- 按照下面流程安装
- 官网流程:
- Open the MSI file you downloaded and follow the prompts to install Go.By default, the installer will install Go to
Program FilesorProgram Files (x86). You can change the location as needed. After installing, you will need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt. - Verify that you’ve installed Go.
- In Windows, click the Start menu.
- In the menu’s search box, type
cmd, then press the Enter key. - In the Command Prompt window that appears, type the following command:
$ go version
d. Confirm that the command prints the installed version of Go.
- 打开安装包,选择 next

- 点击 next

- 选择默认安装路径,点击 next

- 点击 install

- 打开
cmdC:\Users\zhi'yong>go versiongo version go1.16.3 windows/amd64
2. Linux 安装
选择 Downliad Go
指定目录解压
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz
修改
~/.bashrc# golang# go 语言的根目录export GOROOT=/usr/local/go# go 语言的工作目录export GOPATH=$HOME/go# 加入到环境变量export PATH=$PATH:$GOROOT/bin
source ~/.bashrcgo versionchenzy@chen211:~/zhiyong/go/bin> go versiongo version go1.15.6 linux/amd64
