1. Download and install
The download address of the installation package is: https://golang.org/dl/ .
If you can't open it, you can use this address: All Versions - Go Programming Language (google.cn)
The default installation is under the C drive, you can customize the path but be careful not to include Chinese
2. Environment configuration
Enter the GO folder after installation as follows:
Next, configure the environment variables:
Right-click This Computer -> Properties -> Advanced System Settings -> Environment Variables to open the Environment Variable Settings window.
Click on New System Variable
Create two new environment variable configurations,
One is GOROOT , which is the configuration of the directory where the Go environment is located.
One is GOPATH , which is the working directory of the Go project , and the code developed in the future will be written in this folder.
Click New in the red box in the figure, enter GOROOT in the variable name column , and enter the directory where your GO file is located in the variable value column (mine is D:\Go\Go). Finally, click OK to create a new GOROOT .
When configuring GOPATH , I suggest configuring two directories, separated by English semicolons
A named library is used to store third-party packages
A named workspace is used to store your code
Finally click OK to complete the configuration
Finally, configure the newly created GOROOT to the path environment variable,
find path in system variables ,
Click Edit -> New , enter %GOROOT%\bin
, and click OK.
And click OK in all windows to ensure that the environment variables take effect.
This completes the installation!
3. Verify
Friends who are worried about not installing it can verify it in the following ways:
Press Win + R and enter cmd to open the command line window
Enter go version and press Enter
Enter the following to indicate a successful installation
Well, I wish you a good swim in the ocean of knowledge. Finally, if you think this article is helpful to you, you can give the author a thumbs up!