-
Notifications
You must be signed in to change notification settings - Fork 570
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
Support debugging for tests #1855
Comments
Is it possible to debug tests with delve? If so, then this is a valid use case. |
@dlsniper yes, it's possible @JasonRosenberg there are no technical reasons, just matter of time. We'll implement it eventually. |
@zolotov I'd be happy to give this one a try but I've tried to do the Go Single File configuration debugable first, as I guess the test runner should be changeable following the same principle, and I've got deeply stuck. I've managed to make dlv launch but I don't have the debugging interface active for some reason. The commit is here: https://github.com/dlsniper/google-go-lang-idea-plugin/commit/98b060eb0c13b04a13eb4e93d6f5ee595e006ff8 Can I have any pointers please? Thank you. |
+1 |
I wolud say that I much more frequently run and debug tests than applications. So it is a very important feature for people that workflow is similar to mine. |
+1 |
1 similar comment
+1 |
+1 |
+1 |
So, before anyone else +1's this anymore, I have a working version of this, however, https://github.com/derekparker/delve/issues/423 is being a major blocker for it imo. I'll submit the PR soon for review but imho the hacks I've done there should be solved before merging. |
Any updates on this? |
@tnine not really, I currently lack the time to do the refactoring and finish it out but I'm trying to make some progress. Please follow the PR for this (and feel free to help out). |
Any update on this? |
any update? |
@dlsniper, what is the best way to help with this? I tried cloning your fork but could not find any existing code for debugging a test. |
I'm confused as to the status. I see #2750 is closed. Is there a way to grab a pre-release and debug tests? |
@slowenthal It's still WIP.
See commits above which reference this issue. #2750 is simply one of many duplicates of this issue and was closed as such. It's closure has no bearing on the status of this issue. |
This is not a real plugin. it's just cheap monkey-patch for idea for golang |
A quick (working for me) hack:
The script will take the first param (test) to switch mode, will build the test (replacing the app binary), and call dlv. Idea and the golang plugin will believe it's debugging the app. Breakpoints in the test work. Variations possible - to run individual methods, etc. |
For the app config: just a dummy app ( package main, nothing inside ). I suppose naming the dummy app "test_hack" and changing the script to use What happens is that golang plugin believes it's debugging an app - and the On Tue, Nov 8, 2016 at 10:00 AM Fredrik Blomqvist notifications@github.com
|
Got it working, thanks! Will do until proper support is implemented. For some reason it was not able to resolve dependencies within the same package, so I had to put the tests in "mypackage_test" and import "mypackage", but after that it worked. |
This seems like a solid work around, but I'm missing something. I swapped out the
Ideas? |
The work around has 3 steps, and it helps to add 'echo' statements to the
The last step can be customized as you want - but before tricking the An interesting trick is to compile a normal binary by hand, run it - and |
@fgblomqvist I had the same issue, but was able to get around that by changing @costinm 's step 3 instruction to:
|
@zolotov any pointers or direction for adding this to the plugin? I'd like to take a pass at it. I was going to start from this commit https://github.com/dlsniper/google-go-lang-idea-plugin/commit/101fce199d83277a6295dc0f981bccaa730cffc9 |
@dave-r12 Try the Gogland EAP -- debugging tests works great in there. |
Oh wonderful, thanks for the heads up! |
@richpoirier , good job! |
@richpoirier Brilliant! Although after debugging a few rounds the option was disabled. |
@gheibia if you have any issues with the debugger in Gogland please open an issue here: https://youtrack.jetbrains.com/issues/Go It should not disable itself at any given time but without further details I can't help out. Thank you! |
The problem still exists in Gogland when you setup "edit configuration" as "Go Single File". Setup your project-file as "Go Application" :) |
@SerkanSipahi how you define applications run configurations doesn't have an effect how test configurations are defined. |
@dlsniper sorry i forgot to complete my sentense. I think it was to late :) I mean: Setup your project-file as "Go Application" will work but not when it configured as "Go Single File" |
@SerkanSipahi that is correct. Only Go Application type is supported for now in the debugger, both in the plugin and Gogland. Gogland has support for debugging tests. What you are asking for is not related to tests. |
If this is already implemented in EAP, can it get ported to the golang IDEA plugin? |
The EAP and https://plugins.jetbrains.com/plugin/9568-go plugin are maintained by JetBrains. This plugin is currently not actively maintained and I have no intention to port the functionality any time in the foreseeable future. |
Any updates? |
@MEGApixel23 nobody contributed anything for this functionality in this plugin. Meanwhile JetBrains released GoLand, their Go IDE and it has full support for this. You can use the IDE from here: https://www.jetbrains.com/go/ or as a plugin in IntelliJ Ultimate (2017.3+). |
Hi @antonlisovenko, this is the wrong place to report issues about the Go plugin maintained by JetBrains. Please report issues in the future here: https://youtrack.jetbrains.com/issues/Go As for the particular issues you mentioned:
|
@antonlisovenko I've created https://youtrack.jetbrains.com/issue/GO-5602 to specifically track the second issue. For the first issue see: https://youtrack.jetbrains.com/issue/GO-3433. Please vote/start them go get updates for them. Thank you. |
I have just tried using the new delve debugger integration, which appears to be a great start. I am using IntelliJ 141.1532, and version 0.9.491 of the plugin (which claims to be an alpha version for 1.0.0). I am using Go 1.4.2 sdk.
Anyway, it is possible to debug files and packages that have a 'main' method. But there does not appear to be a way yet to debug tests, via the test integration within IntelliJ.
Is this something that could be added easily enough (or are there technical reasons preventing it?)
The text was updated successfully, but these errors were encountered: