Go language Learning Road One: Development environment configuration

Source: Internet
Author: User
Tags install go

1. Install Go

1): Http://www.golangtc.com/download, after downloading directly double-click MSI file installation, installed by default in C:\go

2) After the installation is complete, the environment variable Path is added to the bin directory under the Go installation directory C:\Go\bin\, and the environment variable goroot is added, and the value is C:\Go\ of the go installation root directory.

3) Set Workspace Gopath directory (project path for Go language development)
Windows settings, create a new environment variable name called Gopath, the value of your working directory, such as the author's settings gopath=e:\goworkspaces, in this directory to create a new three subdirectories:

SRC store source code (e.g.,. Go. C. h, etc.)
The files generated by the PKG after compilation (for example:. a)
Executable file generated after bin compilation (for convenience, you can add this directory to the path variable in Windows and append%gopath%\bin to the environment variable path)

2, Installation Liteide

For http://sourceforge.net/projects/liteide/files/. Download the liteide extract to d:\ to complete the installation.

2.1 setting up an editing environment

Because it is a one -bit environment, select "Win64". View The Edit environment variable to confirm that the goroot variable matches the GO installation path. such as:

2.2 adding gopath

View -- management gopath ... , create a new directory E:\Code_Repository\golang , and add to " Custom Catalog ", such as:

2.3 New Project

Select the gopaththat you added in the previous step, and the template is Go1 Command Project, see:

Edit the source code and add a few lines of code, including variable declaration, initialization, and assignment, to verify that debugging is in effect. , the test code is as follows:

Package Main

Import "FMT"

Func Main () {

Fmt. Println ("Hello World")

}

2.4 setting compilation options and compiling

Compile -and-compile configuration, set compilation parameters. add -gcflags "-n-l"in Buildargs to eliminate compilation optimizations and facilitate debugging.

Ctrl+b Build the project, build the hello.exe

2.5 Debug Program

Press F5 to start debugging, the program stops at the main function

single-Step debugging with F10

Go Language Learning Path One: development environment configuration

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.