Sublime Text3 Configuring the Go compilation Environment

Source: Internet
Author: User
Tags sublime text gocode
Sublime text here will introduce Sublime Text 3 (hereinafter referred to as Sublime) + Gosublime + gocode combination, then why choose this combination? The automation hint code, as shown in Figure 1.5 sublime automated prompt interface saved by automatic formatting code, so that you write more beautiful code, in line with the go standard. Support project Management Diagram 1.6 Sublime Project management interface support syntax highlighting sublime Text 3 is free to use, just save the number of times to a certain amount will be prompted whether to buy, click Cancel to continue to use, There is no difference between the official registration version. Then start to talk about how to install, download sublime according to their respective system to download the appropriate version, and then open Sublime, for unfamiliar sublime classmate can first look at this article Sublime Text Whole guide or sublime Text3 Getting Started tutorial after opening the package control:ctrl+ ' Open command line, execute the following code: for Sublime Text 3:import urllib.request,os;pf= 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 ()) applies to sublime Text 2:import Urllib2,os;pf= ' package control.sublime-package '; Ipp=sublime.installed_packages_path (); Os.makedirs (IPP) Ifnotos.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 ());p rint (' Please restart Sublime Text to finish installation ') This time restart Sublime, you can find in the menu bar more than one of the following columns, Description The package control has been installed successfully. Figure 1.7 Sublime package Management after installation, you can install sublime plug-in. To install Gosublime, sidebarenhancements, and go Build, after installing the plugin remember to restart sublime to take effect, ctrl+shift+p open the package controll input PCIP Control:install package "abbreviation). At this time, the lower left corner shows that the packet data is being read, and the following interface appears after completion Figure 1.8 Sublime Install plugin interface this time enter Gosublime, press OK to start the installation. The same applies to sidebarenhancements and go Build. Installing Gocodego get-u github.coM/nsf/gocodegocode will be installed in the default ' $GOBIN ' also recommended to install gotests (generate test Code): first install the gotests plug-in sublime, and then run: Go get-u-v github.com/cweill/ gotests/... To verify that the installation is successful, you can open the sublime, open the Main.go, see if the syntax is highlighted, input import is not an automated hint, import "FMT" after the input FMT. Is the automation prompt has a function. If this prompt is already present, you have completed the installation and have completed the automatic prompt. If this is not the case, your $path is generally not configured correctly. You can open the terminal, enter Gocode, is not able to run correctly, if not, it means that $path is not configured correctly. (for XP) Sometimes the terminal can run successfully, but sublime no hint or compile decoding error, please install sublime text3 and convert UTF8 plug-in to try MacOS has been set $goroot, $GOPATH, $GOBIN, There is still no automatic prompt to do. Please use COMMAND + 9 in sublime, then enter the env check $path, Goroot, $GOPATH, $GOBIN and other variables, if not please use the following method. First establish the following connection, and then start directly from the terminal sublimeln-s/applications/sublime\ text\ 2.app/contents/sharedsupport/bin/subl/usr/ Local/bin/sublime94 Times Click  
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.