1. Download the Windows installation package and install
Download Windows installation package from official website https://golang.org/, such as go1.10.3.windows-amd64.msi
.
Double-click the installation package to install it and install it to the path by default C:\Go\
.
The installation package automatically adds the following "system variables" to the "Environment variables":
(1) GOROOT
, the value isC:\Go\
(2) Path
, append;C:\Go\bin
The installation package automatically adds the following "User variables" in the "Environment variables":
(1) GOPATH
, the value is%USERPROFILE%\go
(2) Path
, append;%GOPATH%\bin
Note:
(1) The environment variable is viewed as follows:
Right-click My Computer, properties, select Advanced system Settings, advanced, click Environment variables
(2) %USERPROFILE%
value
In the Command Window (cmd) echo %USERPROFILE%
, you can get the values, such asC:\Users\Administrator
2. Modify the working PATH environment variable
Assuming that you later write the go code with a working path D:\go-work
, locate the "environment variable", "User variable" GOPATH
, and modify its value toD:\go-work
3. Install git
Download the 64-bit Windows installation package from the https://www.git-scm.com/download/website and install it.
4, Installation Vscode
Download Windows installation package from official website https://code.visualstudio.com/, such as VSCodeSetup-x64-1.25.1.exe
.
Double-click to install.
5. Change the interface environment to Chinese
Input, enter in the Ctrl + Shift + P
command Window lang
, select in Find results, Config Display Language
Add in open local.json
file "locale":"zh-cn"
, restart Vscode.
Set Chinese
6. Install the Go plugin in Vscode
Click "Extensions" at the bottom of the tool on the left, or enter, Ctrl + Shift + X
enter GO
, click on the Go plugin for the query Microsoft
to install, and reload after installation is complete.
Go Plugin
7. Cloning tools, lint code base
Since golang.org is blocked at home, it is possible to download its image from github.com. Here's how:
In cmd, enter:
mkdir %GOPATH%\src\golang.org\xcd /d %GOPATH%\src\golang.org\xgit clone https://github.com/golang/tools toolsgit clone https://github.com/golang/lint lint
8. Installing auxiliary Tools
Run Vscode, open any *.go
file, click Analysis Tools Missing
on the tool installation in the lower right corner
Analysis Tools Missing
The tool installation process is as follows:
Tool installation Process
9. Conclusion
At this point, go development environment has been built! Enjoy yourself!
Resources
1, https://golang.org/
2, Https://code.visualstudio.com/docs/languages/go
3, https://blog.csdn.net/alexwoo0501/article/details/73409917
Reprint Please specify: author Gisxiaowei, starter book jianshu.com