Skip to content

debug: delve dap launch mode fails without go.mod #875

@hyangah

Description

@hyangah

dlv built from the master (3fd78fc)
go version 1.15.3

package main
  
func main() {
  println("hello")
}

and there is no go.mod file.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch (delve DAP)",
            "type": "godlvdap",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "env": {},
            "args": [],
            "logOutput": "dap",
            "showLog": true,
            "trace": "verbose"
        }
    ]
}
Verbose logs are written to:
/var/folders/bw/6r6k9d113sv1_vvzk_1kfxbm001py5/T/vscode-godlvdapdebug.txt
2020-11-2, 17:03:26.632 UTC
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"godlvdap","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true})
InitializeRequest
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true}}
InitializeResponse
From client: launch({"name":"Launch (delve DAP)","type":"godlvdap","request":"launch","mode":"debug","program":"/Users/hakim/tmp/scale","env":{"ELECTRON_RUN_AS_NODE":"1","USER":"hakim","PATH":...]
launchRequest
Running: /Users/hakim/go/bin/dlv dap --listen=127.0.0.1:42042 --log=true --log-output=dap
dlv stdout: DAP server listening at: 127.0.0.1:42042
dlv stderr: 2020-11-02T12:03:26-05:00 debug layer=dap DAP server pid = 8743
dlv stderr: 2020-11-02T12:03:26-05:00 debug layer=dap [<- from client]{"seq":2,"type":"request","command":"launch","arguments":{"__sessionId":"c116f53e-ee2d-47c8-96fa-f34b3933b335","apiVersion":2,"args":[],"dlvLoadConfig":{"followPointers":true,"maxArrayValues":64,"maxStringLen":64,"maxStructFields":-1,"maxVariableRecurse":1},"dlvToolPath":"/Users/hakim/go/bin/dlv","env":{[...]
dlv stderr: import "/Users/hakim/tmp/scale": cannot import absolute path
dlv stderr: 2020-11-02T12:03:27-05:00 error layer=dap Failed to launch: Build error: exit status 1
dlv stderr: 2020-11-02T12:03:27-05:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":2,"success":false,"command":"launch","message":"Failed to launch","body":{"error":{"id":3000,"format":"Failed to launch: Build error: exit status 1"}}}
To client: {"seq":0,"type":"response","request_seq":2,"success":false,"command":"launch","message":"Failed to launch","body":{"error":{"id":3000,"format":"Failed to launch: Build error: exit status 1"}}}

See the error import "/Users/hakim/tmp/scale": cannot import absolute path.
Not sure yet what's the expected behavior in this case (where no go.mod file exists and the directory is outside GOPATH).
go build, dlv debug, and old debug adapter seem ok with it.

Metadata

Metadata

Assignees

Labels

DebugIssues related to the debugging functionality of the extension.FrozenDueToAge

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions