登录
首页 >  Golang >  Go问答

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

来源:stackoverflow

时间:2024-02-13 13:45:16 434浏览 收藏

一分耕耘,一分收获!既然都打开这篇《VScode 调试模式找不到我的 config.json 文件》,就坚持看下去,学下去吧!本文主要会给大家讲到等等知识点,如果大家对本文有好的建议或者看到有不足之处,非常欢迎大家积极提出!在后续文章我会继续更新Golang相关的内容,希望对大家都有所帮助!

问题内容

我正在尝试在 vscode 上调试 go 应用程序,但找不到我的 config.json。我在读取配置时发生 error。恐慌:打开config.json:系统找不到指定的文件错误。

这是我的 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}"
        }
    ]

终于介绍完啦!小伙伴们,这篇关于《VScode 调试模式找不到我的 config.json 文件》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布Golang相关知识,快来关注吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>