Skip to content

default launch configure "mode": "auto", run fail(could not launch process: not an executable file), when active editor _test.go file #3874

@iyaozhen

Description

@iyaozhen

Is your feature request related to a problem? Please describe.
default launch package configure
Image

{
    "name": "Launch Package",
    "type": "go",
    "request": "launch",
    "mode": "auto",
    "program": "${workspaceFolder}"
}

It is quick start normal go project, main.go in workspaceFolder.
But when active editor xxx_test.go file, mode auto is test

In auto mode, the extension will choose either debug or test depending on active editor window.

layer=dap building from "/path": [go test -c -o /path/__debug_bin3337152289 -gcflags all=-N -l .]
layer=dap launching binary '/path/__debug_bin3337152289' with config: {
        "mode": "test",
……
layer=debugger launching process with args: [/path/__debug_bin3337152289]
layer=dap Failed to launch: could not launch process: not an executable file

The correct log should be, mode is debug

layer=dap building from "/path": [go build -o /path/__debug_bin688196312 -gcflags all=-N -l .]
layer=dap launching binary '/path/__debug_bin688196312' with config: {
        "mode": "debug",

This does not align with my intuition. I haven't set ${file}.

Of course, this is not a bug. It's just unfriendly to newbies.

Describe the solution you'd like
default configure mode set to debug
OR detect "program": "${workspaceFolder}" and main() function, not just test file. After all, Many tutorials say to set it up like this.

Describe alternatives you've considered
I set mode to debug

Additional context
That's another question. not an executable file fail unfriendly and no more information. #94

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions