-
Notifications
You must be signed in to change notification settings - Fork 645
goreturns not unstable in module mode #2309
Comments
Please let me know if that works for you. |
I can confirm |
Thanks for confirming that @nezorflame What we can do to improve this experience is to use PRs are welcome for this Code Pointers:
|
@ramya-rao-a I can't find any |
@open-source-explorer You need to import |
@ramya-rao-a I made an attempt to refactor the code based on my assumptions. |
This still isn't working. I've tried a whole bunch of different configurations, including the suggestion above. It seems to work on simple imports but when there are few different possibilities, it just does nothing. Running the My configuration is as follows:
I'm using a regular GOPATH setup, without modules. I'm using vscode 1.31.1 on Mac OS X. The extension is version 0.9.2 |
@stevvooe When you see that |
I run it from the directory root, but it works fine either way. I suspect something is wrong with how the tool is being called. Is there a way to print the command that is being run, like some debug mode? |
It also seems to happen when there are multiple imports to add. I'll see if I can get a minimal example, but it would be easier if I could just see what command is being run, as I suspect its not formed correctly. |
Regarding the original issue here about goreturns vs goimports for modules: In the latest beta version (0.9.3-beta.2) of this extension, if you are using modules, your workspace settings will be updated to use @stevvooe If the formatting failed, then there will be logs with the exact call being made. From the Please log a new issue with your findings. I am closing this issue as we now use goimports instead of goreturns when using Go modules |
The fix for this issue is out in the latest release(0.10.0) of the Go extension |
For about a year the auto-formatting using goreturns or goimports has continuously alternated between working and not working (with more time spent in the not working state). gofmt, of course, always works fine.
From one of several (closed) issues about this same problem:
goreturns
work when you manually format the file in VS Code i.e right-click -> Format Document?Go: Install/Update Tools
, selectgoreturns
to updateAgain, I expect this to suddenly start working again randomly at some point. But then it will stop working again randomly at some point.
I do use go modules and for some reason have the vague impression that it's related.
The text was updated successfully, but these errors were encountered: