Build Eclipse+golang development environment on Windows

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Weekend is OK, plan to learn a weekend language, finally selected the current more popular go language, usually used to use eclipse as the main development tool, here is how to build the Golang development environment in Eclipse, mainly installs the Goclipse plug-in.

1. Download and install go and configure environment variables

Because the country can not access Google, to download the official website of the installation package need to go agent, if not, you can download http://www.golangtc.com/download in Golang China, according to the number of system bits to select the zip file download, this is free installation version, direct decompression, Configuring Environment variables

Install directory for new variable name Goroot,value=go

In the path of the celestial sword%goroot%\bin

Create a new variable name Gopath, custom directory, you must configure this variable name

Now that go has been installed, the test is normal, open cmd, execute go command, see if there is a print

If not, see if the environment variable is configured correctly

2. Eclipse Installation Goclipse

If the wall can be turned over, then eclipse->help->install new Software->add to download the installation, to ensure that Eclipse has installed the CDT premise

Download link http://goclipse.googlecode.com/svn/trunk/goclipse-update-site/

If you do not have access to foreign sites, in the Eclipse Marketplace search installation, in eclipse4.5, I did not search, only through the first download installation, can be found in eclipse4.6+, click Install Download installation

After the installation is complete, restart Eclipse, where window->preferences can see

Click Go to configure the Go installation directory

When you click Tools, install the Go tool plugin

Among them, gofmt can be found directly in the bin directory of Go, godef refers to click download Download, download will automatically backfill, Gocode and Guru is unable to download backfill, need to build their own hand, the method is as follows

First you need to install the GIT shell locally, install the tutorial on the Internet to find, after the installation is complete, the above Gopath directory is configured as a git local repository

Go to cmd and execute go get-u-v github.com/nsf/gocode

Execute Go get-u-v golang.org/x/tools/cmd/guru

After each execution, the corresponding code is downloaded in the directory, and the EXE file is automatically generated in the Bin directory.

Fill in the corresponding Gocode.exe.guru.exe, Eclipse integration Goclipse This completes, then you can start the first program Hello Word

New A Go Project projects, new package under SRC, because the SRC directory can not directly put the go file, under the package to create a new Hello.go, execute code

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.