Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Go 查找gitlab.com/company/project/.vscode最新版本_Go_Visual Studio Code - Fatal编程技术网

Go 查找gitlab.com/company/project/.vscode最新版本

Go 查找gitlab.com/company/project/.vscode最新版本,go,visual-studio-code,Go,Visual Studio Code,当我使用以下设置运行调试时,我正在尝试使用vscode调试go项目: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version

当我使用以下设置运行调试时,我正在尝试使用vscode调试go项目:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "envFile": "${workspaceFolder}/.env.local",
            "args": [],
        }
    ]
}
我得到:

go: finding gitlab.com/company/project/.vscode latest
can't load package: package gitlab.com/company/project/.vscode: unknown import path "gitlab.com/company/project/.vscode": cannot find module providing package gitlab.com/company/project/.vscode
exit status 1
Process exiting with code: 1

我能做些什么来修复它?

听起来像是在调试时编辑.vscode文件夹中的文件(例如,您引用的launch.json文件)。调试是相对于您打开的文件的(正如您在配置中看到的
${fileDirname}
)。因此,最简单的修复方法是确保在尝试调试时打开了要调试的Go文件


如果您只想调试项目中的一个二进制文件,您可以覆盖
launch.json
中的
program
设置,以始终指向该包。

听起来好像您在调试
.vscode
文件夹中编辑文件(例如,您引用的
launch.json
文件)。调试是相对于您打开的文件的(正如您在配置中看到的
${fileDirname}
)。如果您只想调试项目中的一个二进制文件,您可以覆盖该设置以始终指向该包。我真的不知道该怎么办。我希望vscode像他目前所做的那样进行go构建,然后启动debug。是打印${fileDirname}结果以检查内容的一种方法吗?正如我在评论中所说的,只需打开一个实际的Go文件而不是使用
launch.json
open运行调试。啊,好的,你说得对,我可以消除错误:)谢谢!你可以把它作为一个答案