1, download Golang and unzip (here to extract to $HOME/golang/directory for example): http://www.golangtc.com/download2, create Gopath related directory (here to $HOME/golang/projects /catalogue For example): mkdir ~/golangmkdir ~/golang/projectsmkdir ~/golang/projects/3rdpartymkdir ~/golang/projects/3rdparty/ Binmkdir ~/golang/projects/3rdparty/pkgmkdir ~/golang/projects/3rdparty/srcmkdir ~/golang/projects/ownmkdir ~/ Golang/projects/own/binmkdir ~/golang/projects/own/pkgmkdir ~/golang/projects/own/src3, in $HOME/.BASHRC Add the following and save (do not restart) export goroot= $HOME/golang/goexport gopath= $HOME/golang/projects/3rdparty: $HOME/golang/projects/ Ownexport goarch=amd64export goos=linuxexport gobin= $GOROOT/binexport path= $PATH: $GOROOT/bin4, Installation Gocode, Enter the following command at the terminal: Go get-u github.com/nsf/gocodego install GITHUB.COM/NSF/GOCODE5, download and install Sublime Text 3, download address:/http WWW.SUBLIMETEXT.COM/3 Click on the appropriate "system type" link to download the installation package. 6, to Sublime text 3 to install the package Control: Open Sublime text 3, press Ctrl + ' (back quote, Tab key above), enter the following content and return: 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 ()) Restart Sublime Text 3 after the installation is complete. 7. Install Gosublime and sidebarenhancements: Open Sublime text 3, press Ctrl + Shift + P, enter PCIP return in the popup window, and Sublime Text 3 will search through the network for installable Package information, wait a moment, will pop up the package list, enter Gosublime carriage return, waiting for gosublime installation is complete. After installation, you may be prompted Goroot Gopath is not set, regardless of it, and so on will be set (this and the system environment variables set in the Gopath goroot irrelevant). Press Ctrl + Shift + P again, enter PCIP carriage return in the popup window, wait a moment, will pop up the package list, enter sidebarenhancements return, wait for sidebarenhancements to install. 8. Set Gopath and Goroot: Open Sublime Text 3, Menu "Preferences, Package Settings, Gosublime, Settings-default", open Go Sublime configuration file, modify env settings information: {...//omit "env": {"Goroot": "~/golang/go", "Gopath": "~/golang/projects /3rdparty:~/golang/projects/own "}, ...//omit} set complete to restart Sublime Text 3. 9. Complete Setup: Open Sublime Text 3, write a Golang code, and save it as Test.go.
--------------------------------------------------package main import ( "FMT " ) func Main ( ) {fmt. Println ("Hello world!") )}--------------------------------------------------
Press Ctrl + B to open the Compile window and enter go run./test.go to run the current file.
Repost: http://www.cnblogs.com/golove/p/3810931.html