SublimeText3搭建go语言开发环境,windows

SublimeText3搭建go语言开发环境(windows)

下载并解压:

Sublime Text Build 3064.zip

安装PackageControl:

The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.

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)

安装GoSublime插件:

打开 Sublime Text 3 以后,在Preferences菜单下找到 Package Control,点击打开,会出现一个Package Control界面,输入 Install Package,等待一段时间,会出现另一个界面,这时候,输入GoSublime,点击出现的项,就可以成功安装GoSublime了。

添加build菜单

tools->build system->new build system

{

"cmd" : ["go", "install"],

"file_regex" : "^(...*?):([0-9]*):?([0-9]*)",

"working_dir" : "${file_path}",

"selector": "source.go"

}

 保存为go.sublime-build

安装gocode:

An autocompletion daemon for the Go programming language

Gocode is a helper tool which is intended to be integrated with your source code editor, like vim and emacs.

从源代码编译获得

获取源码

go get github.com/nsf/gocode

源码白下载到了%GOPATH%/src目录

编译

go install github.com/nsf/gocode

将生产的gcode.exe 放在sublime_text.exe能调用的地方,建议放在%GOROOT%\bin目录中

安装SublimeGDB插件:

打开Preferences菜单下,Package Control菜单,并选择 Install Package选项,输入SublimeGDB

参考:http://www.cnblogs.com/yourihua/archive/2012/11/12/2766763.html