1、安装sublime text 3 ,目前gosublime不再支持sublime text2
2、安装之后打开sublime,安装package control,打开控制台control+`,在控制台输入:
import urllib.request,os,hashlib; h='7183a2d3e96f11eeadd761d777e62404'+'e330c659d4bb41d3bdf022e94cab3cd0'; 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)
3、重启sublime,打开preferences,多了package control以及其setting,安装成功
4、ctrl+shift+p打开控制面板选择 install packages,安装gosublime
5、设置gosublime,preferences->package-setting->user:
{
"env": {
"GOPATH": "/Users/XXX/mygo",
"GOROOT": "/usr/local/Cellar/go/1.6.2/libexec"
}
}
6、设置go build, tools->build system->new build:
{
"shell_cmd": "go build $filename"
}
有疑问加站长微信联系(非本文作者)