Installation and environment variable settings for Go language under Windows platform

Source: Internet
Author: User

1. Go Language SDK installation package download and install the latest stable version of 1.5.3 installation package, size about MB (author uploaded a copy of the version of the installation package to CSDN resources, too foreign Slow speed can go to download:, after downloading directly run the installation, the installation path will use its defaultC:\Go\Next and complete the installation.

2. Go Language environment variable setting the Go language requires the configuration of the Goroot and Path environment variables: goroot and Gopath.
2.1 root directory Goroot and path if the first step installation uses the default installation directoryC:\Go\, the installer has set the Goroot and Path environment variables so that they do not need to be manually set.

If you do not use the default installation directory for the first step, you need to manually configure the above two variables, noting that the Path configuration does not affect other installers (such as Java,oracle,maven, etc.).
2.2 Go Working directory Gopath This is a follow-up code directory, create a new system variable Gopath, point it to your code directory:

2.3 Command line validation of environment variables open CMD Terminal, enter go env to see if the variable is set successfully:

Note that the red box mark part is correct.
3. Write the first Go program to create a hello.go file and edit its contents as follows:
Package Mainimport "FMT" Func Main () {    fmt. Printf ("Hello, world\n")}

After saving, go to the directory and execute go run Hello.go:

See "Hello, World" to prove that our go installation was successful.
    • The Go programming language-getting Started

Installation and environment variable settings for Go language under Windows platform

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: 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.