My Emacs Manual: Go
目录

Install

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) # install gvm
gvm install go1.4 -B
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.7

Plugins


go get github.com/rogpeppe/godef
go install github.com/rogpeppe/godef
go get github.com/nsf/gocode
go install github.com/nsf/gocode

go get golang.org/x/tools/cmd/... # godoc

go get github.com/nsf/gocode # go-eldoc

go get -u golang.org/x/tools/cmd/goimports # goimports


go get -u golang.org/x/tools/cmd/guru
go get -u github.com/dougm/goflymake

Commands

Key Function Description
C-c C-d godef-describe 代码释义
M-. godef-jump 代码跳转
M-, 代码返回

guru(C-c C-o [KEY])Go Guru的使用:

  • j jump to definition
  • r referrers
  • f free names (== if a selected block is turned into a function, what params are needed?)
  • d describe expression (== show function params or type of identifier)
  • i show implements (== what interfaces does this thing implement?)
  • < show callers to a function
  • > show callees to a function
  • s show call stack (== possible paths from main())
  • p show points-to
  • e show which errors
  • c show channel peers

发表评论