Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> As far as I can tell you can’t step through tests in the debugger

Maybe I am missing something, but that is not correct. You can debug tests the same way as you debug any other code. Even works with the mentioned/used Go extension for VS Code.



It's quite possible that it's just my laziness in figuring out how to do it.

All I know is that hitting 'F5' in VSCode builds the binary and runs it under the debugger.

How would I debug the equivalent of `go test` in VSCode?


I have no idea in VSCode, but with JetBrains Gogland, debugging tests is stupidly easy. Simply add the breakpoint where you want it, left click on the play button in the line of the test declaration, click debug in the contextual menu, and off you go.


too bad sometimes it doesn't resolve pointers correctly


In Go test files, there's now a codelens annotation above every Test function with "run test" and "debug test" commands. Just click "debug test" to launch a debugger against that test.

See https://twitter.com/ramyanexus/status/860190148239081472

If you want to configure F5 to launch tests instead of your main entry point, you can do that too in your launch.json file.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: