Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are CGO projects supported? #50

Closed
peter-mogensen opened this issue Dec 4, 2016 · 5 comments
Closed

Are CGO projects supported? #50

peter-mogensen opened this issue Dec 4, 2016 · 5 comments

Comments

@peter-mogensen
Copy link

I found out go-mode.el didn't allow me to use godef on exactly those symbols defined in CGO files.
It can be boiled down to that godef will not report this definition:

package test

/*
#include <stdio.h>
*/
import "C"

func Testing() string {
	return "testing"
}

However, if the import "C" line is included in the comment, the definition is reported correctly.

... using Go 1.7.3
main prg:

package main

import (
	"fmt"
	"test"
)

func main() {
	fmt.Println(test.Testing())
}
@joeblew99
Copy link

@peter-mogensen did you get confirmation on this ?

i have the same issues over here i think:
therecipe/qt#163

@peter-mogensen
Copy link
Author

No - I didn't ... however, looking more into this it seems like a very fundamental problem not limited to godef.
However, it's really unfortunate limitation. It would be very nice to be able to navigate to functions defined using CGO.
I seem to recall that the deciding factor is whether there's an "import "C"" statement in the file. So what you could do is to locate all exported API in separate files not using CGO and have them call private functions in files using "import "C""

@joeblew99
Copy link

thanks for the tip. i wil ask the maintainer over at the QT project.

the others that use the intelli IDEA IDE dont have the issues that VSCode has. they get full intellisense, but they need to devote more RAM to the process for it to work.

@therecipe
Copy link

There seems to be an open pr that solves this #44

@rogpeppe
Copy link
Owner

This should have been solved by #62.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants