Original post

0

didn’t find any setup that like i can do in the launch config, here is example

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "env": {},
            "args": [
                "-test.v",
                "-test.run",
                "TestLog"
            ]
        }
    ]
}

(*testing.T).Log doesn’t actually print out logged messages unless a test fails. Calls to Log are cached and then after the test completes, the testing package checks if it failed or succeeded. If it failed, all log events are printed with the hope that it’ll help the user identify the problem. If it succeeds, then there’s no reason to print the logs.

If you want to force the log messages to print, then add this to your user settings JSON file in VS code:

    "go.testFlags": [
        "-v"
    ]

yes, i can do it when i click the button run test, but debug test button doesn’t accept this setup.

the debug test button will call delve to run debug

Is the issue that you cannot step into t.Log or that you’re not seeing the output of t.Log?

cannot see the log

debug function works well

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.