'How to run single file from go integration tests that use suite in vscode?

I have integration tests in golang that I want to run in the vscode debugger. After some laying around I got this to mostly function using the launch.json configuration

"version": "0.2.0",
"configurations": [
{
    "name": "debug entities test",
    "type": "go",
    "request": "launch",
    "mode": "test",
    "program": "${workspaceFolder}/targetingd/integration/entities_integration_test.go",
    "buildFlags": "-tags=integration",
    "env": {
        "PULL_REGISTRY": "xxxx"
    }
 } 

However I say this 'mostly' works because it's actually running the full integration test suite, not just entities_integration_test.go as I wanted. I'd like to configure this to only run one test file and not waste time on the rest.

I know if I was running this from the command line I could use the --run tag but I'm not sure what the equivalent is within the launch.json.

I don't know if it matters but were using both suite and dlv for these tests.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source