Settings for Golang in Emacs

Source: Internet
Author: User
Tags function definition gocode

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.