A bug in Godef

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Godef can print out the symbols in the Go source code, many integrated development tools have integrated it, and provide Go to Definition commands and shortcut keys, can quickly jump to the method and the declaration of the variable place, very convenient.

For example, I used the vscode-go, provided such a function, but at present Godef has a bug, is not able to jump net to the standard library package method definition, the bug has been submitted to GitHub: #18, about June when the bug was found, It is unclear why the author did not fix, in fact, someone had provided a modified pull request earlier. The reason for this bug is that Godef did not handle the "C" library properly.

I am here to record the modification method, you can manually modify the compilation godef.

Locate the parser file (go/parser/parser.go) under the Godef folder and add a judgment in line 1970.

1234567
   Name, err: = P.pathtoname (littostring (path), filepath. Dir (filename))if"C" {   //The following three lines are new to modify this bug new added line if"" "C" "C"} if "" {

This way your godef will work properly.

In addition, if you upgrade to Go1.7 found that the Vscode Code autocomplete function does not work, you can try to execute in the terminal gocode close , this bug can refer to: 441.

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.