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

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

The first is to install go

Here are the detailed installation instructions, Http://code.google.com/p/golang-china/wiki/Install or Http://golang.org/doc/install

Below we install under window, Google has to provide win installation package, for beginners or very simple!

Https://code.google.com/p/go/downloads/list

Configuring Environment variables

(1). New variable name: GOBIN variable Value: C:\go\bin

(2). New variable name: Goarch Variable Value: 386

(3). New variable name: GOOS Variable Value: Windows

(4). New variable name: Goroot variable Value: C:\go

(5). Edit path at the end of the variable value of path plus%gobin%

After installing the go, we can build the development environment , here I use Sublime Text 2 + gosublime + Gocode. For those who do not know sublime Text 2, you can look at the official website: http://www.sublimetext.com/(generally a lightweight, handy tool)

1. Download Sublime Text 2, address as follows: http://www.sublimetext.com/

2. After the decompression, double-click Sublime_text, you can use sublime text 2. Crack: Open the Sublime_text.exe file with the Winhex hex editor, jump to the 000cbb70 line, change the line's 8A C3 to B0 and save.

3. Install the package Control, after opening Sublime Text 2, press the shortcut key Ctrl + ', open the Command window line, ' This button on the TAB key above, I just started not found, hehe. Enter the following and return to:

Import Urllib2,os; pf='Package Control.sublime-package'; Ipp=sublime.installed_packages_path (); Os.makedirs (IPP)ifNot Os.path.exists (IPP)ElseNone; 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'

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

5. 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).

6. Install Gocode below,

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)

7. 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:

Pressing the shortcut key below the Ctrl + B interface will appear as follows:

Enter Go build hello.go

Run, also press the shortcut key Ctrl + B below the interface will appear below, 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.