This is a creation in Article, where the information may have evolved or changed.
To prevent others from stepping on the pit again, close-up.
First, download
The official web site has been wall. The current reliable download address is:
- Go Language Chinese Web: https://studygolang.com/dl
- Golang China: https://www.golangtc.com/download
Click on any URL to enter the download page. Novice recommends downloading the installation package, whose name is generally Go1.9.windows-386.msi or go1.9.windows-amd64.msi. Be careful not to get the wrong version.
Second, installation
The first step
Double-click the *.msi installation package and follow the prompts to install it, recommended by default.
Step Two
Set environment variables. This is the most error-prone step for novices, note.
To do this, follow the steps:
first , "My Computer" and "Properties" = "Advanced system settings" and "advanced" as shown in:
123.jpg
then, "environment variable" = "new" as shown in:
Image.png
then, enter in variable name and variable value, respectively:
Variable name: goroot
Variable Value: C:\Go (If you change the installation location, add the modified position here)
Click "OK" when you are finished filling out.
Note that the next step is the key and is the easiest one to let the novice confuse, setting "Gopath". Here's how:
See, click "New" and enter in the "Variable name" and "Variable Value" respectively:
Variable name: Gopath
Variable value: C:\GOPATH, or other custom location, but not the same as the location of Goroot, this should be paid special attention .
then , find the "path" variable, select, click Edit, see:
Image.png
finally , add the following to the "path" variable value:
Be careful not to lose the wrong, or miss out ";" And so on, it is recommended to copy directly.
Three, test
Test it for a moment.
Open "cmd" and enter:
go version
See if you have just installed the version.
Input:
go env
See if "Goroot" and "Gopath" are just the contents of the setup.
If everything is expected, it represents a successful installation.
Iv. concluding remarks
Thinking students will be asked to set the "Goroot" and "Gopath" what is the meaning of it? Can you tell me how they work? Must this be set? This is a lot of interesting questions, if interested, you can search. Of course, it is also possible not to care about these problems first, not to affect the next step of learning.