简体   繁体   English

如何在 vscode 中调试以 heroku 本地 web 开头的 go 应用程序

[英]How do I debug a go app started with heroku local web in vscode

I have a go app deploying on heroku.我有一个 go 应用程序部署在 heroku 上。 usually I start with heroku local web and attach debugger later by find process id.通常我从heroku local web开始,稍后通过查找进程 ID 附加调试器。

how can I start into debug mode?我怎样才能进入调试模式?

Thanks谢谢

this may not be the best answer, the only thing I need for debug is load.env in the first place, which heroku cli did that.这可能不是最好的答案,我唯一需要调试的是 load.env 首先,heroku cli 做到了。 I figured vscode allows set a envFile in the launch config.我认为 vscode 允许在启动配置中设置一个 envFile。

{

    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceRoot}/main.go",
            "envFile": "${workspaceFolder}/.env"
        }
    ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Heroku上使用Go Web应用程序构建实用程序? - How do I build utilities with my Go web app on Heroku? 如何查看对在Heroku local中运行的Go应用程序所做的更改? - How can I see the changes I make to a Go app running in Heroku local? 如何使用多个 go 文件在 VSCode 中启动调试 session? - How can I launch a debug session in VSCode with multiple go files? 如何使用 VSCode 远程调试 Go 代码 - How to remotely debug Go code with VSCode VSCode 如何找到这个 Go 掉毛问题,我该如何忽略它? - How is VSCode finding this Go linting Problem and how do I ignore it? 如何为 Golang 和 AppEngine 设置 VScode 调试会话? - How do I setup VScode debug session for Golang and AppEngine? 如何在 vscode 中设置 Go 调试标志并知道您是否在调试中运行 - How to set Go debug flag in vscode and know if you are running in debug 如何使用主程序包在子目录中将Go应用程序部署到Heroku? - How do I deploy a Go application to Heroku with main package in subdirectory? 如何在 Google Cloud Run 中运行 go-cloud-debug-agent,以便我可以在 Stackdriver Debug 中调试我的 go 应用程序 - How to run go-cloud-debug-agent in Google Cloud Run so that I can debug my go app in Stackdriver Debug 如何调试用 Go 语言编写的程序? - How do I debug a program written in the Go language?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM