Configuring the Go Development environment in WIN10 system eclipse

Source: Internet
Author: User
Tags gocode

The basic services of Ethereum are developed using the go language, and Eclipse is the current free open source strong IDE that provides plug-ins for go development, so building a eclise-based go development environment will help you quickly learn the Ethereum source code. This article mainly introduces the process of configuring the Go development environment in eclipse under the WIN10 system.

First, the basic software preparation

Description: This article uses the Windows 10 64-bit operating system, and if you select a 32-bit operating system, select the appropriate version to install the software.
1, go install package: Download Go1.10.1.windows-amd64.msi from HTTPS://STUDYGOLANG.COM/DL. (http://www.golang.org/website need to turn over the wall)
2, c/d development environment: Download Mingw-w64-install.exe from http://www.mingw.org/.
3. java 1.8: Please download version 1.8 from http://www.java.com.
4. Eclipse: Please download from https://www.eclipse.org/downloads/eclipse-packages/, select Eclipse IDE for Java developers or Eclipse IDE for C /c++ developers versions are available.

Second, software Installation

1, Go development environment installation

    • Double-click Go Installer follow the prompts to the next, you can install the program in C:\Go;

2, MINGW-W64 development environment installation

    • Double-click Mingw-w64-install.exe, follow the prompts to install, can be installed in: C:\MinGW64 directory;
    • After the installation is complete, the network installation package is required, because the Sourefoge speed is slow and unstable, you can download the software package: x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z;
    • After downloading, unzip to the C:\MinGW64\mingw64\ directory to complete the installation;

3. Java environment and Eclipse installation

    • Install the Java environment First, according to the prompt installation can;
    • Unzip eclipse to your development work disk;
    • Menu Help, install New software Search Goclipse plug-in, installation completed restart eclipse;

4. Configure Environment variables

The system should have the following environment variables, if not, please set manually:

    • Goroot:c:\go\ (depending on the Go installation path setting)
    • Gopath:d:\goworkspace (Individual Go Project development path, according to the Personal development environment)
    • Java_home:c:\program files\java\jre1.8.0_111 (based on personal installation path settings for Java)
    • Path increased:
      1.c:\go\bin (Go executable program installation directory)
      2.c:\program Files\java\jre1.8.0_111\bin (Java executable program installation directory)
      3.c:\mingw64\mingw64\bin (c\c++ executable installation directory)

Third, configure Eclipse

The go tools for configuring eclipse mainly include:
1. Gocode is the code auto-complete program;
2. Guru Code navigation program;
3. Godef Code Jump Program (CTRL + left mouse Click to view the defined code;
4. GOFMT code beautification program;
Let's take a look at the effect of the implementation, as shown in several external programs:

Eclipse Configuration Go tool. png

1, the compilation of Gocode

    • Download Gocode source Https://github.com/nsf/gocode, then extract the files to the working directory;
    • Start the Command Line window, enter the corresponding directory, use go install to compile;
    • Copy the Gocode to the bin file of the Go installation directory;

2, the compilation of Guru

    • Download guru source code https://github.com/golang/tools;
    • Then in the Go installation directory src directory to create a new Golang.org/x/tools/cmd/guru folder, and then the extracted source copy of the past;
    • Start the Command Line window, enter the directory, start compiling go install Golang.org/x/tools/cmd/guru, check whether the compilation is successful;
    • Copy the Guru to the bin file of the Go installation directory;

3, the compilation of Godef

    • Download Godef source Https://github.com/rogpeppe/godef, same as unzip the file;
    • Then, in the SRC directory, create a new folder as follows D:\Go\src\github.com\rogpeppe\godef, and then copy the contents of the extracted files to the new folder;
    • Start the Command Line window, enter the directory, enter the compile command go install;
    • Copy the Godef to the bin file of the Go installation directory;

5. Configure the Debug tool

    • Download Liteidex31.windows-qt4;
    • Unzip the file and locate the GdB file in the bin directory, selecting 32-bit or 64-bit files according to the operating system of your computer;
    • Copy the Gdb64.exe to the Go installation directory under the bin file;
    • Select the Eclipse->run->debug Configurations menu to configure, see the schematic description;
Debug Configurationsgo Program Debug Configuration. png

The above configuration is complete, the IDE environment of GO is finished!

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.