If you want to do something good, you should make it better. Some useful settings for using EMACS24 to do Golang development are documented below.
One, the code jumps in the Golang
Godef-describe,godef-jump and Godef-jump-other-window are used by default in Emacs24 Go-mode for code jumps, while godef-* commands require an external program godef to find the function definition. The installation steps are as follows:
1, install Godef
1) Set Gopath and Gobin, set Gobin to/usr/local/bin
2) Go get github.com/rogpeppe/godef
3) Go install Github.com/rogpeppe/godef
Note: Godef can also be obtained from code.google.com/p/rog-go/exp/cmd/godef
2, install the latest go-mode in Emacs24
3, using:
Code interpretation with M-x godef-describe or c-c c-d
Code jumps with M-x godef-jump or c-c c-j
Code return with m-*
Second, the code completion in Golang
Golang code completion requires the use of the Gocode command. The installation steps are as follows:
1, install Gocode
1) Set Gopath and Gobin, set Gobin to/usr/local/bin
2) Go get Github.com/nsf/gocode
3) Go install Github.com/nsf/gocode
2. Install the latest Auto-complete plugin in Emacs24
3. Copy the file Github.com/nsf/gocode/emacs/go-autocomplete.el file to the $load-path directory of Emacs
4, do the following in. Emacs:
(Require ' go-autocomplete) (Require ' auto-complete-config) (Ac-config-default)
Third, other useful settings
See my Emacs configuration file at: Https://github.com/cobblau/MyEmacs
Settings for Golang in Emacs