Sublime TEXT3 + Golang Building development environment

Source: Internet
Author: User

1. Install git

Because Golang is managing remote packages via Git, we'll first install git, download the address: http://www.git-scm.com/download/.

Git installation is simple, just next (in the Windows Explorer integration option, "git Bashhere" and "Git GUI here" tick), Need to know the specific installation can be seen here.



2. Installing Golang

1) First go to https://golang.org/dl/to select the appropriate installation package for your system (inside the wall: http://golangtc.com/download).

2) I choose here: Go1.4.2.windows-amd64.msi, Download complete installation to the specified directory. I am here (E:\Go).

3) After the installation is complete, the environment variable has been automatically set, you can call out the cmd command Line input command to view

> Go env


As you can see, the Go command already appears. If you can't appear, it could be an issue with setting the environment variable.

Go to My Computer , advanced Settings , environment variables see if thegoroot variable exists, and if the Path variable is also set Goroot. If not, add a goroot variable and the path will enter the root directory of Go after you have just installed it, as mine is: E:\Go\. Then edit the Path variable and add ";%goroot%bin" to the last face.


4) Thego command relies on an environment variable:Gopath, this is not the Go installation directory, but your work (engineering) directory (your code will be in that directory). Gopath can have more than one, Windows is separated by semicolons (;), the Linux system is a colon (:), when there are multiple Gopath , the default is to put the contents of go get in the first directory. Here we create a new gopath variable, in my case: F:\mygo.



3. Install sublime Text3

The first is also download: HTTP://WWW.SUBLIMETEXT.COM/3, installation is also a fool, directly next.

Note: Sublime is a fee-free software, not registered can also be used normally, just save the number of times to a certain amount of time will be prompted to buy, after ignoring the normal use.


Here you need to install a sublime pakcage control feature to install the sublime plugin next.

1) After opening the software, press the shortcut key Ctrl + ', (' This symbol is in the English half-width mode, press the Tab key above, the number key 1 to the left of the button), this time a command window will open, copy and enter the following, and finally return:

Import Urllib.request,os,hashlib; h = ' eb2297e1a458f27d836c04bb0cbaf282 ' + ' d0e7a3098092775ccb37ca9d6b2e4b7d '; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); by = Urllib.request.urlopen (' http://packagecontrol.io/' + pf.replace (', '%20 ')). read (); DH = hashlib.sha256 (by). Hexdigest (); Print (' Error validating download (got%s instead of%s), please try manual install '% (DH, h)) if DH! = H Else Open (Os.pat H.join (IPP, PF), ' WB '). Write (by)

If you encounter an error, refer to the installation here: Https://packagecontrol.io/installation#st3.


2) After restarting Sublime, you can find the menu item in the Preferences menu under the package Control, as shown in figure:



4. Installing the Gosublime plugin

1) in Sublime, press and hold the shortcut key SHIFT + CTRL + Pto enter the installpackage in the popup box, as shown in the figure:

2) Enter, the following image will appear (may need to wait a little, you can see sublime the bottom of the state):

3) Input gosublime, enter (may need to wait a little, can see sublime the bottom of the state), as shown:

4)Gosublime After installation is complete,Preferences , package settings , gosublime , Settings-uesrs needs to be configured under gopath,goroot, as shown in figure:

5) Enter the following in the open window, the path should be replaced by itself, ctrl+s save.

{"
env": {
"Gopath": "F:/mygo",
"Goroot": "E:/go"
}
}

6) Restart Sublime, in the Gopath src new hello.go file, you can see the code auto-completion has come out,:)


At this point,sublime Text3 + Golang installation is complete.



Attached to my sublime text3 simple configuration, Preferences - Settings User empty copy and paste.

{
"font_size": "
highlight_line": True,
"Highlight_modified_tabs": True,
"Ignored_packa GES ":
[
" Vintage "
],
" Soda_classic_tabs ": True,
" soda_folder_icons ": True,
   "Tab_size": 4,
"translate_tabs_to_spaces": True,
"Update_check": false,
"Word_wrap": Tru E
}

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.