英文:
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"
}
]
}```
config.go文件的级别比src文件夹高一级。我已经附上了我的工作区结构的截图。我做错了什么?
<details>
<summary>英文:</summary>
I am trying to debug a go application on VScode, but my config.json can't be found. I am getting a ```Error occurred while reading config.
panic: open config.json: The system cannot find the file specified``` error.
This is my launch.json file and I have my workspace path set to the src, which is where I have my go files and main package.
``` "version": "0.2.0",
"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
</details>
# 答案1
**得分**: 0
尝试使用以下配置:
"configurations": [
{
"name": "启动包",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
<details>
<summary>英文:</summary>
Try this config
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论