Sublimetext, Eclipse, Liteide--golang Development Environment Building (Windows edition)

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

Go SDK Installation

Visit Golang's official website, http://golang.org, click Download Go button or direct access, HTTP://GOLANG.ORG/DL, go to download page

Download the MSI installation version, or the source version (must be installed through the source code), we recommend the use of the installation version, go directly to the lake.
At installation time, the default path can be used, which is generated in the C:/go directory, and the C:/go/bin is already added in the system environment variable.
Enter go in cmd, the reality is that the installation is successful.

Configure Gopath


and add the%gopath% to the environment variable
Multi-platform detailed installation can refer to: Https://golang.org/doc/install

Build IDE Development environment

Sublime Text

1. Download Sublime text (optional version) on the official website, http://www.sublimetext.com/
2. Install the Package Control panel
Step sharing

There are two ways to install through the console input a script, and through the preferences > Browse Packages way.
Here, use the script to install
Open the Sublimetext, use the shortcut key Ctrl + ', open the console, copy the following script and paste it into the console.

Import Urllib2,os,hashlib; h =' eb2297e1a458f27d836c04bb0cbaf282 '+' d0e7a3098092775ccb37ca9d6b2e4b7d '; PF =' Package control.sublime-package '; IPP = Sublime.installed_packages_path (); Os.makedirs (IPP)if  notOs.path.exists (IPP)ElseNone; Urllib2.install_opener (Urllib2.build_opener (urllib2. Proxyhandler ())); by= Urllib2.urlopen (' http://packagecontrol.io/'+ PF.Replace(' ','%20 ')).Read(); DH = hashlib.sha256 ( by). Hexdigest ();Open(Os.path.join (IPP, PF),' WB ').Write( by)ifDH = = hElseNone; Print' Error validating download (got%s instead of%s), please try manual install '% (DH, h)ifDH! = hElse ' Restart Sublime Text to finish installation ')

After execution, prompt to restart sublime text, and then add a new Package Control menu command to the Preferences menu

Then install the Gosublime plugin

Press CTRL + SHIFT + p or click Tool--Command Palettle
Enter install Select Package Install and then enter
Enter in the pop-up input box gosublime , and return to

and start the Golang tour.

Eclipse

Build Golang development environment based on Eclipse, mainly to install a plug-in goclipse, you can pre-download the plug-in, and then choose Local installation, you can also use the online installation (need a good network environment support).
Plugin Download Address: HTTP://PAN.BAIDU.COM/S/1SJP9WGL

Then wait a little bit and reboot

Configuring Eclipse's Golang Environment, Gocode, GDB

Windows-Preferences Go

Configure Gocode
Visit: Https://github.com/nsf/gocode Look at README.MD instructions
A gopath environment variable needs to be set (previously set)
Then open the command line and execute the following command

-u-ldflags-H=windowsgui github.com/nsf/gocode

After execution, the Gocode.exe file is generated in the bin directory of the Gopath
Then configure Gocode in eclipse

If you want to use debugging, you can use it with liteide to implement debugging by referencing the GDB provided by Liteide (see below)

After the configuration is complete, you can also start the Golang tour in eclipse
1. New Go Project
2. To create a new go File under SRC, refer to the example below

package  main/** This program refered by network**/ import  (" FMT " " Io/ioutil " " Net/http " ) Func main () {URL: =  "http://www.baidu.com"  resp, _: = Getbyproxy (URL) F Mt. PRINTLN (RESP) defer resp. Body.close () body, _: = Ioutil. ReadAll (resp. Body) fmt. Println (String (body))}//http Get by proxy  func getbyproxy (url_addr string) (*http. Response, error) {request, Err: = http.        Newrequest ( "GET" , url_addr, nil) if  err! = Nil { return  nil, err} return  http. Defaultclient.do (Request)}  

Liteide

Download address, select the appropriate platform and version
Http://golangtc.com/download/liteide
Open the Liteide.exe in the bin directory,

The tool is simple and easy to learn and use.

Good luck

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.