golang development environment

2015-04-15 KasperDeng 更多博文 » 博客 » GitHub »

golang IDE

原文链接 https://kasperdeng.github.io/go-dev-env/


  • Download go
  • Go Complier:
    • offcial: gc
    • GNU GC: gccgo
  • Go supports 3 instruction sets
    1. amd64 (a.k.a. x86-64); 6g,6l(Plan9 gc),6c,6a // support x84-64, naming as amd64 is to amd's contribution of inventing 64bit instruction set
    2. 386 (a.k.a. x86 or x86-32); 8g,8l,8c(Plan9 gc),8a
    3. arm (a.k.a. ARM); 5g,5l,5c(Plan9 gc),5a
  • Set Env Variables
    • GOBIN: C:\Go\bin (optional, if no GOBIN, GOPATH will be used)
    • GOARCH: x86-32bit: 386, x86-64bit: amd64, ARM: amr (android)
    • GOOS: windows
    • GOROOT: C:\Go
    • To specify directories outside of $GOROOT that contain the source for Go projects and their binaries.
    • Add to PATH: %GOBIN%
  • Multi-Version GO Env
    • GVM
    • an interface to manage Go versions, like NVM(Nodejs Version Manager), RVM (Ruby Version Manager)
  • Reference in astaxie/build-web-application-with-golang




  • Install package control
    • "ctrl + `" or Menu: View -> Show console: input
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

    • Install GoSublime
    • ctrl+shift+p -> input install -> input GoSublime
    • preferences —> package setting —> gosublime —> setting default, update env
    • Restart sublime
    "env": {
    "comp_lint_enabled": true,
    "comp_lint_commands": [
        {"cmd": ["go", "install"]}
    "on_save": [
  • ctrl+p -> gosublime: to find related gosublime functions and key binding
  • keybinds: ctrl+.,ctrl+g: definition
  • Build
    • ctrl+b (cli console in sublime), then run the go commands
  • gosublime drawback: read code with goto definition but no easy way to go back.

  • Ref:

    • http://www.v-lover.com/2014/12/24/go-built-environment/
    • Godef for Sublime (currently not support windows)


  • Lots of golang package support
    • go-plus (but currently failed to install in my workspace)


  • vim-go
    • PluginInstall: Vundle: Plugin 'fatih/vim-go'
    • GoInstallBinaries (need install Mercurial and add C:\Program Files\Mercurial\ to PATH)
    • Install ctags: e.g. In Ubuntu, sudo apt-get install ctags and in /usr/bin/ctags
    • Config the ctags path for tagbar: let g:tagbar_ctags_bin = '/usr/bin/ctags' (Ubuntu)
  • Add key mapping to .vimrc, e.g. au FileType go nmap gdf <plug>(go-def)
  • Vim build-in <C-o> and <C-i> help back/forward of code definition naviation
  • <C-x><C-o> auto go code complete by omnicomplete system, <C-n> to select.
    • Add config to vimrc to support invoke gocode for code completion
" Golang
au BufNewFile,BufRead *.go setf go
autocmd FileType go setlocal omnifunc=go#complete#Complete
  • If no config, use the gvim-ex which support it by default (unknown why)
  • autocompletion is dependent on the gocode, when golang upgrade, please upgrade the gocode by go get -u github.com/nsf/gocode

    • YouCompleteMe (Code-completion for Vim, but no official support on Windows)
    • Supports in cygwin vim, using imported env variable from Windows. Currently found godef has limitation in cygwin to browse the code definition in $GOPATH/src(config problem?)
    • godef issue in go v1.4
  • Need to update the godef and build it by self


  • Gonpp


  • Ref: http://www.cnblogs.com/clivelee/p/3870186.html
  • golang plugin
  • Setup Go project SDK


JetBrains, commercial IDE, extends the IntelliJ platform

  • Not formal release yet. Can download an early build for trial


  • Goclipse


Zeus IDE

  • TBD


LiteIDE is a simple, open source, cross-platform Go IDE. Based on Qt5/Qt4

  • easy installation and usage
  • based on Qt, gui is not fashion style