简体   繁体   English

如何在 vscode 中设置 Go 调试标志并知道您是否在调试中运行

[英]How to set Go debug flag in vscode and know if you are running in debug

Do you know how to set debug flag in vscode, similar to this你知道如何在vscode中设置调试标志,类似于这个
Note: the question is stated "as in C#" and for Golang(Go code)注意:问题是“在 C# 中”和 Golang(Go 代码)

There is no "debug flag" for an editor.编辑器没有“调试标志”。 For most compiled languages, a debug flag will exist if you compiled the program in debug mode.对于大多数编译语言,如果您在调试模式下编译程序,将存在调试标志。

That link you posted is a different issue.您发布的那个链接是一个不同的问题。 Debugger.IsAttached for c# checks for the presence of the dotnet debugger, also has nothing to do with the editor. Debugger.IsAttached for c# 检查是否存在 dotnet 调试器,也与编辑器无关。

Just use settings, and in my case writing go - you just set:只需使用设置,在我的情况下编写 go - 你只需设置:

"go.buildTags": "delve",

And then follow the already mentioned accepted answer然后按照已经提到的接受的答案

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM