1. 程式人生 > >VSCode遠程調試Go程序方法(Attach)

VSCode遠程調試Go程序方法(Attach)

ogr env .json head -h mod [] vscode mode

  1. set launch.json
        {
            "name": "Attach",
            "type": "go",
            "request": "launch",
            "mode": "remote",
            "remotePath": "${workspaceRoot}",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [],
            "showLog": true
        }
  1. go build && run
  2. get pid && dlv attach pid --headless --listen=:2345 --log
  3. in VSCode, Click begin debug button

VSCode遠程調試Go程序方法(Attach)