Golang configuration installation in the Windows environment

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Use the MSI file and follow the prompts to install the Go tool. By default, the Setup program uses the go-to distribution in c:\Go. The setup program should set the C:\Go\bin directory to the Windows PATH environment variable. Restart any open command prompt for the changes to take effect.

1. On the official website Go:https://golang.org/dl/    download   msi file, but now this site may be wall, so if you do not want to use the latest version can not go over the wall, Baidu network disk has a lot of installation files

2. Install select installation path, environment variables will be automatically configured during installation

3. Verify that after the installation is successful, enter the following command in the console to indicate success:



4. Verifying the installation
Create a go file named Test.go D:\goproject
File:test.go

Import "FMT" Func Main () {   fmt. Println ("Hello, world!")}



Attention:

Func Main () {
Can not be written
Func Main ()
{
This is not just code specification, but also the syntax of Go. Or you'll get an error.


5 Compiling run Go code go run xxx.go



Compile the Go code to generate the. exe file go build xxx.go will generate the Xx.exe file



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.