This is a creation in
Article, where the information may have evolved or changed.
1. Install Go
Download address https://golang.org/dl/(need to be turned down)
After downloading to a similar go1.8.3.linux-amd64.tar.gz installation file
- Perform
tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz
- Adding environment variables
export PATH=$PATH:/usr/local/go/bin
- Choose a location to put go items (usually
~/go/ )
- Continue to add environment variable Goroot to set the directory
export GOROOT=~/go for the Go Projectexport PATH=$PATH:$GOROOT/bin
- Enter the command at any path
go version , the version output proves that the configuration was successful
2. Configure Sublime
- Install the package Control
CTRL + ' shortcut key to bring up the console, enter the following code to install Paackge control
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())
-
Ctrl+shift+p Open the Package controll input PCIP (the abbreviation for the "Package Control:install package").
Install in sequence
- Gosublime
- Sidebarenhancements
- Golang Build
-
Installing Gocode
Terminal inputgo get github.com/nsf/gocode
After restarting sublime, you can feel the automatic code hints for auto go.
3. Set Sublime Build
If you want sublime to build the Go project directly, you need to modify the Golang Config
Open Package Setting, Golang Config, Settings-user, enter
{ "osx": { "PATH": "/Users/jsmith/go/bin", "GOPATH": "/Users/jsmith/go" }, "windows": { "PATH": "C:\\Users\\jsmith\\go\\bin", "GOPATH": "C:\\Users\\jsmith\\go" }, "linux": { "PATH": "/usr/local/go/bin", "GOPATH": "/home/userName/go" }}