VScode 调试模式找不到我的 config.json 文件

VScode debug mode can't find my config.json file

我正在尝试在 VScode 上调试一个 go 应用程序,但是找不到我的 config.json。我收到 Error occurred while reading config. panic: open config.json: The system cannot find the file specified 错误。

这是我的 launch.json 文件,我的工作区路径设置为 src,这是我的 go 文件和主程序包所在的位置。

    "configurations": [
        
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceRoot}\src"
        }
    ]
}```

The config.go file is a level higher than the src folder. I have attached a screenshot of my workspace structure. What am I doing wrong?



 [![screenshot of my workspace structure][1]][1] 


  [1]: https://i.stack.imgur.com/mz4KL.png

试试这个配置

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