Go language development environment building

Source: Internet
Author: User
Tags sublime text gocode

Installation of 1.Go

(1) Download Go installer: https://golang.org/dl/(Wall http://www.golangtc.com/download), if your system is WINDOWS32 bit system, Please select Go1.3.3.windows-386.msi to

(2) After download directly double-click MSI file installation, installed by default in C:\go
(3) After the installation is complete, the environment variable Path is added to the bin directory under the Go installation directory C:\Go\bin\, and the environment variable goroot is added, and the value is the Go install root directory C:\Go\
(4). Verify that the installation is successful, enter CMD in the Run Open command line tool, enter go at the prompt

(5) Set Workspace Gopath directory (project path for Go language development)
Windows settings are as follows, a new environment variable name is called Gopath, and the value is your working directory, such as the author's settings Gopath=e:\mygo

The above%gopath% directory Convention has three subdirectories:
SRC store source code (e.g.,. Go. C. h, etc.)
The files generated by the PKG after compilation (for example:. a)
Executable file generated after bin compilation (for convenience, you can add this directory to the path variable in Windows and append%gopath%\bin to the environment variable path)
(6) Use the Go ENV command to view environment variable settings

2, download Gocode implementation code hint

Enter in cmd

Go get Github.com/nsf/gocode

Go Install Github.com/nsf/gocode

If not, directly to download a gocde.exe online (http://download.csdn.net/detail/xiaofengtoo/5328303) actually download the source code is compiled into Gocede.exe.

Put the Gocode.exe into the Bin folder under the Go installation directory and you're done.

3. Download Sublime Text 3

Originally I was downloaded sunlime text2 result configuration go, write HelloWorld is reported this error Failed to construct IPC body:encode error: ' UTF8 ' reason is not utf-8 for go file is no B The format of the OM is read. Go also does not support this code, so the error. But sublime Text 3 is fine.

Http://www.sublimetext.com/3

ST3 's hack recommends the way to Deadwood blog:

Http://www.xiumu.org/note/sublime-text-3.shtml

4. Configuration Sublime Text 3

Installation of the package control

After opening Sublime Text 3, press the shortcut key Ctrl + 'to open the Command window line, ' This button is on the TAB key, enter the following command

Import Urllib.request,os; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.path.join (IPP, PF), ' WB '). Write (Urllib.request.urlopen (' http://sublime.wbond.net/' + pf.replace (', '%20 ')) . Read ())

After installation, restart St, you can use the package control

The Gosublime plugin is now installed, and holding ctrl+shilft+p will pop up a dialog box

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.

Modify the Gosublime configuration: Under the Preferences menu, locate the package Settings, find 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, 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 built.

Reference: http://blog.csdn.net/love_se/article/details/7754274

http://blog.csdn.net/cyxcw1/article/details/10329481

Http://www.xiumu.org/note/sublime-text-3.shtml

Http://www.cnblogs.com/sevenyuan/archive/2013/03/01/2938351.html

http://vincepeng.iteye.com/blog/1965202

Go language development environment building

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.