http://www.philo.top/2015/02/06/golang-%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE%E5%BB%BA%E8%AE%AE/git
要实现上面几点咱们来一步一步的配置。github
这一部分是最重要的,若是没有它,每次build的时候出现 too many errors 内心真的是很是难过的。golang
环境配置:(golint,gooracle,mercurial)shell
shell $ go get github.com/golang/lint $ go install github.com/golang/lint
shell go get code.google.com/p/go.tools/cmd/oracle
shell go get golang.org/x/tools/cmd/goimports
shell go get -u github.com/nsf/gocode
shell go get -v code.google.com/p/rog-go/exp/cmd/godef go install -v code.google.com/p/rog-go/exp/cmd/godef
安装环境的时候常常会出现下载不下来的问题,大概是我网络很差吧。链接google常常出现问题。 > 解决方案: > golang中国的下载频道中有一个第三方包的下载工具,只要输入地址以后人家会给你提供下载tar包的。 > 放到gopath中就ok了。 > 此步骤只能替代Go get的步骤,最后仍是须要go installjson
go install 以后会在 $GOPATH/bin/
中出现各类工具文件vim
最后不要忘记复制上面的命令到 $GOROOT/bin/下面api
Cover Tool: /usr/local/go/pkg/tool/darwin_amd64/cover Vet Tool: /usr/local/go/pkg/tool/darwin_amd64/vet Format Tool: /Users/Li-jianying/git/bin/goimports Lint Tool: /usr/local/go/bin/golint Gocode Tool: /Users/Li-jianying/git/bin/gocode Gocode Status: Enabled Oracle Tool: /Users/Li-jianying/git/bin/oracle Git: /usr/bin/git Mercurial: /usr/local/Cellar/mercurial/3.2.1/bin/hg PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
没有红色的行就没有问题了。( cmd - \)
打开关闭project file( cmd -t )
> 输入的时候按照顺序输入关键字 > 好比说 user模块的controll中的go源代码 > 搜索的时候可使用多个快捷键 =》 user controll go > 就能够准确的找到源代码了( ctrl-cmd-p )
> 而后就会显示出来一个项目列表回车就能够打开项目。总结: > 感受这个插件的treeview用途的确不是很大,由于正常项目的项目文件会不少。 > 不过是快速打开项目(文件夹)是很是方便的,配合快速打开文件仍是至关爽的。网络
按快捷键以后的效果展现: oracle
插件go-plus,autocomplete-plus(dependance),gocode 使用 apm install 安装就能够了。速度还能够。编辑器
使用细节 在保存的时候
使用细节: 在编辑的时候
安装以后的演示(相似go-plus官方演示)
gocode 插件自动补全演示
插件 godef
使用细节: 光标在目标代码上的时候,使用快捷键ctrl-k
跳转到目标代码的定义代码上。
go: 'sh [绝对路径到你的全局run脚上] '+atom.project.rootDirectories[0].path
go tool
实在是太好用了。cmd-d
duplicate linecmd-w
关闭标签cmd-r
文件内的标签列表cmd-e
使用选中的内容作搜索的patternshift-cmd-f
project内部搜索,这个很是实用。command 配置(keymap.cson) >json '.platform-darwin atom-text-editor': 'shift-cmd-D': 'find-and-replace:select-next'