-
Notifications
You must be signed in to change notification settings - Fork 645
gogetdoc doesn't work without opening a folder #2246
Comments
@karim Can you try our latest beta version of the extension that has a couple of bug fixes that haven't been released yet? |
@ramya-rao-a I tried the latest version (0.8.1-beta.6) and it's still the same. I remember it was working before but then I updated Go tools from VS Code and it stopped working. So I tried reverting to an older version of Commit zmb3/gogetdoc@1fd4a45 introduced the bug in this issue. I reverted back to zmb3/gogetdoc@c5ca8f4 and it started working again. This fixed it for me...
Feel free to close this issue and I will open the issue with |
This actually is an issue with the extension and not gogetdoc. The only way to get documentation in both gopath and module mode is for the editor to set the working directory when invoking the tool. It sounds like if you haven’t opened a folder then the extension is not able to detect the correct working directory. Which is reasonable - given only a single file it’s pretty hard to guess at what context you are working in. |
I see, thanks for the clarifications. I thought the issue was with gogetdoc because it was working before without a problem then stopped working (without any changes to the extension).
You are right, opening a folder, or a workspace, is working without a problem. However, VS Code is the default application for .go files. I usually open .go files by double-clicking files randomly, without opening a folder/workspace, then it stops working. |
Right. It worked when you downgraded, but the old version that worked for you would have failed with modules. One thing to try that might work the majority of the time is to use the dirname of the file as the working dir. Alternative approaches would be to search up the directory tree looking for $GOPATH/src or a go.mod file. |
Actually it is working with modules too. To sum everything up..
|
@karim zmb3/gogetdoc#54 was the issue that was fixed with the commit you are reverting in gogetdoc The problem was not with the initial use of gogetdoc in a file in your project, but the subsequent uses in files. For eg, you tried to hover on |
@karim I have pushed another fix. Can you try the latest beta version again? The version should be 0.8.1-beta.7 Try with the latest gogetdoc as well |
@ramya-rao-a Thank you very much. It is working now. 😃 Using latest gogetdoc and 0.8.1-beta.7 the problem is fixed.
I understand it better now, thanks again. @zmb3 Thanks for your quick reply and for this great tool. 👍 |
Thanks for getting back to us @karim and for all the feedback |
Yes, thank you both for the report and troubleshooting as well as the quick fix! ❤️ |
The fix for this is now out in the latest update (0.9.0) to the Go extension |
If I opened a .go file to edit,
gogetdoc
doesn't work. It doesn't show functions docs andGo to Definition
doesn't work, if no folder is opened.But if I opened a folder it started working...
Strangely enough, the folder doesn't have to be the parent folder for the .go file. It can by any sub-folder, even an empty one.
Go version: 1.11.4
VS Code: 1.30.2
Go plugin: 0.8.1-beta.5
gogetdoc
latest version fromGo: Install/Update tools
I think my issue is somehow related to issue #2213? Because I searched for similar issues on why
gogetdoc
isn't working for me. It wasn't working at all with Go plugin v0.8.0 (with and without opening folders) so I checked the latest beta version and it worked only with folders.The text was updated successfully, but these errors were encountered: