How to properly install the Go language (Windows platform September 2017 edition)

Source: Internet
Author: User
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:

    1. Go Language Chinese Web: https://studygolang.com/dl
    2. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.