-
Notifications
You must be signed in to change notification settings - Fork 141
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
godef: no declaration found for (symbol) when package name != containing directory name #18
Comments
+1 Is it idiomatic to walk through the import paths and visit some go file in each package to get it's name? |
The implicit import name makes resolution easier for tools like `godef`, which at the time of writing do not have the capability to resolve nonstandard import paths, for example see rogpeppe/godef#18 I looked into adding it for `godef`, but it did not seem trivial.
I looked into this and it requires a lot of familiarity with how AST parsing/resolution works. With a little guidance, maybe this can be picked up. What I tried naively was to walk through |
I think that the problem is with ImportPathToName Line 26 in f90a996
This thing should really be going into the path specified in the import and figuring out what the name of the package contained in that path is. |
The implicit import name makes resolution easier for tools like `godef`, which at the time of writing do not have the capability to resolve nonstandard import paths, for example see rogpeppe/godef#18 I looked into adding it for `godef`, but it did not seem trivial.
Fixes rogpeppe#18. This is a work in progress/proof of concept implementation.
@tschottdorf I fixed this. Give the version from my pull request a try and see if it works for you. |
I feel like there should be. @rogpeppe this solution feels pretty hacky/gross, which is why I didn't really bother to clean it up much in my PR. Let me know if you would be willing to accept something like this -- If so I'll clean it up and write a test or two. |
Also @rogpeppe why does godef seem to have its own version of the go parser/ast code? |
It looks like #3 was another (much simpler) attempt to solve this issue. What happened to that PR. |
godef has its own version of the go parser code because when it was written, The reason for this bug is essentially that I wanted godef to be fast, so it takes For the record, the speed is gained because godef resolves |
@rogpeppe godef is still plenty fast with this change though. I set the only parse package mode so it should really just open ONE file in the package and read what the package is. I refuse to believe that that has enough of a performance impact to make this change unviable. At the very least, I'd like to see profiling that indicates that it has too large an effect. Premature optimization is the root of all evil. |
@rogpeppe I hand't heard of go guru before. I just got it set up and it seems to work really well. What is merely 'almost there' about it? |
Fixed by #34 |
The implicit import name makes resolution easier for tools like `godef`, which at the time of writing do not have the capability to resolve nonstandard import paths, for example see rogpeppe/godef#18 I looked into adding it for `godef`, but it did not seem trivial.
No description provided.
The text was updated successfully, but these errors were encountered: