vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

Go test profiling: run test with race detector

Open firelizzard18 opened this issue 5 months ago • 1 comments

Is your feature request related to a problem? Please describe. Interpreting the output of go test -race is somewhat cumbersome. It would be really nice if the extension's test support detected race warnings and displayed them somehow.

Describe the solution you'd like

  1. Provide a user action for running a test or tests with the race detector.
    • Option: When the user executes the "Go Test: Profile" context menu action on a test, add "Race detector" to the list of actions.
    • Option: A separate context menu action under "Go Test: Profile".
    • Option: A configuration option to always run tests with -race, or just reuse test flags.
  2. Run the test with -race.
  3. Parse the WARNING: DATA RACE sections out of the output.
  4. Present races to the user.
    • Option: Use the profile viewer: Add the test run as a "profile", with the races as children of it, and the write and previous write as children of each race.
    • Option: Can we reuse the diagnostics that are used for presenting error messages? This has the advantage of being integrated into vscode, showing the code location, and making it easy to show the full stack, but has the disadvantage of not clearly associating the two writes with each other (as in I can't think of a good way to do that).

Describe alternatives you've considered Using the race detector manually.

firelizzard18 avatar Mar 21 '24 15:03 firelizzard18