Sublime TEXT3 + Golang Building development environment

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

http://blog.csdn.net/aqiang912/article/details/46775409

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 GUIhere" tick) , you 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


can see that has appeared GO Command up. 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 multiple, windows with semicolons (;) , the Linux system is a colon (:), and when there are multiple gopath , the contents of go get are placed in the first directory by default. 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.path.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,



4. Installing the Gosublime Plugin

1) in Sublime, press and hold the shortcut key SHIFT + CTRL + Pto enter the installpackage in the popup box.

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

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

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

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.



Attach the simple configuration of my sublime Text3,   preferences  ->  Settings User empty copy and paste.

{"Font_size": "Highlight_line": True, "Highlight_modified_tabs": True, "ignored_packages": ["V  Intage "]," soda_classic_tabs ": True," soda_folder_icons ": True," Tab_size ": 4," translate_tabs_to_spaces ": True, "Update_check": false, "Word_wrap": true}
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.