Sublime Text 2 to build the Go development environment (Windows)

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

For those who do not know sublime Text 2, you can look at the official website: http://www.sublimetext.com/(in general, a lightweight, easy-to-use tool).


1. Download Sublime Text 2 with the following address: http://www.sublimetext.com/.

2. Install the package Control, after opening Sublime Text 2, press the shortcut key Ctrl + ', open the Command window line,' This button is on the TAB key. Enter the following and return to:

Import Urllib2,os; Pf= ' Package control.sublime-package '; Ipp=sublime.installed_packages_path (); Os.makedirs (IPP) if not os.path.exists (IPP) else None; Urllib2.install_opener (Urllib2.build_opener (urllib2. Proxyhandler ())); Open (Os.path.join (IPP,PF), ' WB '). Write (Urllib2.urlopen (' http://sublime.wbond.net/' +pf.replace (', '%20 '). Read () ); print ' Restart Sublime Text to finish installation '

3. After restarting Sublime Text 2, it is possible to find a menu item in the Preferences menus under the package Control.

4. Now that the Gosublime plugin is installed, press and hold ctrl+shilft+p a dialog box will pop up.

Enter the Install Enter dialog box to pop up an installation package

If enter gosublime Select Gosublime Enter

Enter go build to select Enter (this is optional)

Done, Gosublime installed successfully.

After installation, you can install the sublime plugin. Need to install gosublime, sidebarenhancements and Go Build, remember to restart sublime after installing the plugin, Ctrl+shift+p open Package Controll Enter PCIP (the "package Control:install" abbreviation).

5. Install Gocodebelow,

You can go to GitHub to download https://github.com/nsf/gocode.git (to install Google's git version management tool), configure the GIT environment variable:; C:\Program Files\git\bin; C:\Program Files\git\libexec\git-core;

Open the console and enter the following:

    Go get-u github.com/nsf/gocode

    Go install github.com/nsf/gocode

After the installation is complete, we can find an extra Gocode file in the Go/bin directory. (Be sure to put it in the bin directory)

6. Modify the Gosublime configuration: Under the Preferences menu, locate the package Settings, find the gosublime, and then find Settings-default. Re-open the file, add the following configuration, and save:

Well, so far, the development environment has been built.

Open Sublime Text 2 , create a new helloworld.go, and write the following code:

The time to witness the Go Code auto prompt

Enter a P

Carriage return (enter key)

The main method, the package is automatically generated for you.

Here is an example of printing:

Press the shortcut key Ctrl + b The following interface appears below the interface:

Enter Go build hello.go

Run, also press the shortcut key Ctrl + b below the interface, the following interface appears, enter the Hello return.

Well, by now, the development environment has been set up, I hope you will also learn the language of go.


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.