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