The eclipse compiler configures the Go development environment

For now, I will write it when I wake up tomorrow

Proceed as follows:

1. Install JDK

2. Download and install eclipse (this step is very simple, remember to choose eclipse ide for java ee developers for eclipse)

3. Download the goeclipse plugin (eclipse plugin, address http://goclipse.github.io/)

4. Install Git. Since I am in a Windows environment, install msysgit directly (download address https://gitforwindows.org/)

5. Install Go

6. Configure the corresponding environment in eclipse

 

 

Next, the above steps are described.

There are many online tutorials for 1 and 2, so I won't say more.

3. Download the goeclipse plugin.

  First open the http://goclipse.github.io website, select Installation, then open eclipse, click Help->Install new Software, then click Add, enter http://goclipse.github.io/releases/ in Location , Write the name casually, click OK, select Goeclipse in the pop-up box, cancel Contact all update sites during install to find required software, and then click Next to complete the installation of the goeclipse plug-in.

As shown

4. Install Git. Download Git from https://gitforwindows.org/. Since it is an installation package installation, there is no need to configure anything, so I will not introduce it too much.

5. Install the Go language. Log in to https://golang.org/dl/ and download the corresponding version of the Go language installation package. Since domestic users may not be able to log in, you can choose to download from other websites or Baidu Cloud. I provide a Baidu cloud address here. If it expires, you can contact me and send it to you again. Mine is using Microsoft Windows 64 bit version. Address: https://pan.baidu.com/s/1MZyt9H4u1ka7_N3GTRfXDQ

The official website interface is as follows:

 

I am using go1.10.2.windows-amd64.msi  . Just download and install. There is no need to configure any environment variables, just configure them at one time.

6. Configure the corresponding environment in eclipse. This step is the key point .

After the above 5 steps are completed, now open your eclipse, click the "Window" menu item "Preferences" of eclipse. As shown below:

 

 

 Click the "Preferences" menu item, and click the "Go option" on the left to display the following picture:

 

Go installation is the path to choose the Go language installation, which is the path to install go1.10.2.windows-amd64.msi  in the fifth step. It is recommended to install it in the root directory of the C drive by default. It is said that other directories are prone to problems (I did not verify). My directory is as follows.

 

The eclipse gopath is the storage address of Go's project files. This address can be started arbitrarily, but be careful to use the English name as much as possible. Mine is directly built in the Go installation directory of the C drive, C:\Go\GO_WorkSpace. I use it below. here.

After these two items are completed, click the "Apply" button to apply the selection configuration

Then expand the "Go" node on the left, and click the "Tools" tool option, as shown below:

Here are 3 tools that need to be selected, we will do them in order.

(a) gocode needs to download the gocode source code, first log in to github.com/nsf/gocode, then unzip the file, then click the system's Run -> cmd, the cmd command dialog box will pop up, use the cd command to switch to the directory where you unzipped the file, use go The build command compiles the folder. As shown

 

 

Newly generate gocode-master, rename it to gocode, and put the file in C:\Go\bin (since my Go is installed on the C drive), the first step is completed.

(b) First download the guru source code, the address is https://github.com/golang/tools, and then in the src directory under the Go installation directory, create a new folder golang.org/x/tools/cmd/guru, which means Create many nested folders. As shown

Then copy the downloaded guru source code, that is, the tools-master.zip file, and copy all the files in the tools-master.zip folder to the src directory just created, that is, G:\Go language information\tools-master\tools -master all files, copy to

C:\Go\src\golang.org\x\tools. Then in Run->cmd, switch to the src directory and execute go install golang.org/x/tools/cmd/guru. After the compilation is complete, generate the guru file in C:\Go\bin. As shown

 

 (c) In eclipse, select Window->preferences, Go->Tools, in godef, click Download on the right to automatically download the corresponding bin file

 

After the download is complete, it will be automatically associated.

After the above 3 steps are completed, we also need to download a file to debug the Go program. First

https://nchc.dl.sourceforge.net/project/liteide/X31/liteidex31.windows-qt4.zip

 After the download is complete, copy gdb64.exe (select gdb.exe for 32-bit systems) to C:\Go\bin,

 Open eclipse, create a new go project, create a new main directory in the src directory, remember that the main directory must be, and the name cannot be changed. Then create a new go file in the main directory, right click as shown in the figure

 

 In the pop-up dialog box, select C:\Go\bin\gdb64.exe

 

 Well, it's all done now.

Running the program as shown in the figure

 

The download address of the above files:

msysgit download address: https://gitforwindows.org    

Go installation package download address: https://golang.org/dl/

goeclipse plugin download address:  http://goclipse.github.io/releases (online installation package) https://github.com/GoClipse/goclipse.github.io/archive/master.zip (offline installation package)

gocode download address: https://github.com/nsf/gocode

guru download address: https://github.com/golang/tools

godef download address: https://github.com/rogpeppe/godef

gdb64.exe download address: https://nchc.dl.sourceforge.net/project/liteide/X31/liteidex31.windows-qt4.zip

All files are packaged in Baidu Cloud, and there are four gocode, guru, godef, gdb64.exe, which can be put into C:\Go\bin for use without the need for the sixth step 6. Configure the corresponding in eclipse environment.

The addresses of all files are as follows: https://pan.baidu.com/s/1PEIuJm9r2hR3tJq0l5rpcg

 

Referenced articles are:

https://www.jianshu.com/p/48025776632c

https://blog.csdn.net/dgh_84/article/details/54973974

http://www.runoob.com/go/go-ide.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325151235&siteId=291194637