skip to Main Content

platform: windows 10
golang version : go1.21.1 windows/amd64
dlv version : Delve Debugger Version: 1.21.1

launch json:

    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${fileDirname}"
        }
    ]

when I start debug with vscode , It shows :

DAP server listening at: 127.0.0.1:48323
Build Error: go build -o xxxxprojectrpcclientsrc__debug_bin3964848569.exe -gcflags all=-N -l .
client.go:4:2: package fmt is not in std (C:UsersAdmingosrcfmt)
client.go:5:2: package net/rpc is not in std (C:UsersAdmingosrcnetrpc)
package rpc/client/src: cannot find package (exit status 1)

but project can be build successful.
How did I solved this problem? thanks

but project can be build successful.
How did I solved this problem? thanks

2

Answers


  1. {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch Package",
                "type": "go",
                "request": "launch",
                "mode": "auto",
                "program": "${workspaceFolder}",
                "args": [
                    "-o", "output.log"
                ]
            }
        ]
    }
    
    Login or Signup to reply.
  2. After opening your vs code click on main.go file or a file whose package name is (package main) then launch your debugger.

    link for more detail.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search