Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Debug "mode": "test" should support "output" like "mode": "debug" #2445

Closed
leojonathanoh opened this issue Apr 17, 2019 · 3 comments
Closed
Labels

Comments

@leojonathanoh
Copy link

leojonathanoh commented Apr 17, 2019

I've read the documentation on the wiki, which fails to document anything about"output": "/path/to/my/output/binary", which from my testing, applies only to "mode": "debug" and not "mode": "test".

"mode": "test"

launch.json

        {
            "name": "Launch test function",
            "type": "go",
            "request": "launch",
            "mode": "test",
	    "program": "${fileDirname}",
            "env":{
                "GOPATH": "${workspaceFolder}/.go",
                "GOCACHE": "${workspaceFolder}/.cache/go-build",
            },
            "args": [
                "-test.run",
                "TestMyFunction"
            ],
            "output": "${workspaceFolder}/bin/debug.test",
            "showLog": true,
            "trace": "verbose",
        },

Trace:

...
Using GOPATH: /path/to/repo/.go
Current working directory: /path/to/repo/mypackage
Running: /path/to/dlv test --headless=true --listen=127.0.0.1:16482 --api-version=2 --log=true -- -test.run TestMyFunction
...

"mode": "debug"

launch.json

            "name": "Launch file",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${fileDirname}",
              "env":{
                "GOPATH": "${workspaceFolder}/.go",
                "GOCACHE": "${workspaceFolder}/.cache/go-build",
            },
            "args": [],
            "output": "${workspaceFolder}/bin/debug",
            "showLog": true,
            "trace": "verbose",

Trace:

...
Using GOPATH: /path/to/repo/.go
Current working directory: /path/to/repo
Running: /path/to/dlv debug --headless=true --listen=127.0.0.1:3791 --api-version=2 --log=true --output=/path/to/repo/bin/debug --
...

You see in the trace of "mode": "debug" that there is an expected --output /path/to/bin/debug whereas in "mode": "test", there is no expected --output /path/to/bin/debug.test.

This might not be a big issue for most since the in typical Go workflow as explained in #1345, debug / test creates a binary next to the file being tested. However, the fact that the dlv test so explicitly supports it, would mean it's a definitely a feature to be missed.

Version

0.9.2

@ramya-rao-a
Copy link
Contributor

Thanks for reporting @leojonathanoh

The support for the output was added via a community contribution #1564. I wasn't aware that it was supported in test mode as well.

I have pushed a fix and the next update the extension will have support for output in test mode as well

@ramya-rao-a
Copy link
Contributor

The output property is now supported and respected for test mode in the latest update (0.11.1) of the Go extension

@leojonathanoh
Copy link
Author

@ramya-rao-a Great to know that this option is now included. Thanks for the help! 😄

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants