Installation Environment
Operating System Win 10
Go SDK version 1.9.2
Eclipse version photon or later.
First, configure the GO environment variable
The latest stable version 1.9.2 installation package Go1.9.2.windows-amd64.msi download address https://golang.org/dl/, too slow to https://download.csdn.net/download/ weixin_43103088/10639222 download here, run the installation directly after download, the installation path will use its default C:\Go\, then all the way Next and complete the installation. Since the 1.8.0 version, the go language only needs to be configured Gopath (Gopath is the workspace where the personal writing code is stored), and the Goroot and Path environment variables are automatically generated after the installation is complete.
Go environment variables
Ii. Eclipse IDE Type selection and Goclipse installation
When using eclipse to develop the go language, Eclipse must install the CDT (CDT is the Eclipse C + + development IDE plug-in), so we can directly install the Eclipse C + + IDE Editor
Eclipse IDE for C + +
The installation process is omitted (there is no need to say too much for a fool-like operation).
When the installation is complete, open to the top menu: Help >>> Eclipse Marketplace,
Eclipse Plug-in market
Click on the pop-up window, enter go, confirm the search, find the Goclipse plugin, click Install
Installing Goclipse
If you have previously installed a different language version of Eclipse, you can also search for the CDT directly in the plug-in market to install
Three, install three go language widget (key part)
We're going to install the tools three widgets under the Go module and turn on the debug feature.
Gocode is the code auto-complete program;
Guru Code navigation program;
Godef Code Jump Program (CTRL + left mouse click, view defined code);
The GDB64 supports debug programs.
1, first to install Gocode
Open the cmd command line and go to the SRC folder of the Go installation directory and run the following command
#获取gocodego get -u github.com/nsf/gocode#编译gocodego build github.com/nsf/gocode
See if the effect compiles successfully
Next, you can copy the Gocode to the Go installation directory bin file, my directory is installed on the C drive, so directly copied to the C:\Go\bin
2, Installation Guru
Download Guru Source Https://github.com/golang/tools here to move the Tools folder downloaded from GitHub to the golang.org/x/folder (no self-built)
File path
Next, enter the SRC directory in the command line, and then enter the command to start compiling
go install golang.org/x/tools/cmd/guru
Check whether the compilation is successful, go directly to the bin directory to view, the compilation will be successful, a Guru.exe file appears.
3, Installation Godef
Download Godef source code, HTTPS://GITHUB.COM/ROGPEPPE/GODEF, the same as unzip the file, and then in the SRC directory under the new folder C:\Go\src\github.com\rogpeppe\godef, Then copy the contents of the extracted files to the new folder, and finally enter the SRC directory at the command line, and then enter the command to start compiling.
go install github.com\rogpeppe\godef
4, Installation Gdb64.exe
Download Gdb64.exe, then unzip the file, find the bin directory of the gdb file, according to their own computer's operating system to choose 32-bit or 64-bit files, my side is a 64-bit system, so choose Gdb64.exe to go to install directory under the bin file.
Download Gdb.exe file here Https://nchc.dl.sourceforge.net/project/liteide/X31/liteidex31.windows-qt4.zip
To start the GDB configuration, select the following configuration item.
Right-click to select
So configured
Iv. Configuration Goclipse
Then to the top menu open: Window >>> Preference, in the pop-up window of the three previously installed gadgets to configure,
Red Frame Force √ points on
Then press the key, apply to save the changes, the next task, mainly to complete the three configuration
Go->tools
OK, write a section Hello World code to run a bit
package mainimport "fmt" func main(){ fmt.Print("Hello World!")}
Left >run as>go Application
Tips: You cannot put the. go file directly under src/.
Done