admin管理员组

文章数量:1123093

Is it possible to run a single Go test in VS Code with a launch.json configuration?

Here's my OS and Go version

Windows 11
Delve Debugger Version: 1.24.0
go version go1.23.4 windows/amd64

Right now, the closest thing I have is running all tests in a file with this configuration:

// Attempt at running a single Go test
{
    "name": "Go run single test",
    "type": "go",
    "request": "launch",
    "mode": "auto",
    "program": "${file}",
    "args": [
        "^TestDoThing"
    ],
}

I saw someone add the test name to the args in this question, but it didn't affect my results. All the tests in the file still run. Running a single test with a launch.json configuration is more of a convivence than a requirement for me. But I couldn't find any other questions about it or documentation/articles, so I thought it was worth asking about.

本文标签: visual studio codeRun Single Go Test With launchjson ConfigurationStack Overflow