简体   繁体   English

如何使用Go's Delve和Visual Studio Code将对象的值“打印”到控制台?

[英]How do I “print” the value of objects to the console with Go's Delve and Visual Studio Code?

I have the "Delve" debugger setup for Go with Visual Studio code and a super simple program. 我使用Visual Studio代码和一个超级简单的程序为Go设置了“ Delve”调试器。 If I set a breakpoint, and I want to print a variable declared earlier, I'm used to being able to say po foo to print out the value of the object foo to the console, but Visual Studio Code just complains about "expected 'EOF'". 如果我设置了一个断点,并且想打印一个早先声明的变量,我习惯于说po foo在控制台上打印出对象foo的值,但是Visual Studio Code只是抱怨“ expected' EOF'”。

How do I print? 我该如何打印? If I wanted to test things out by printing out values, does Delve not support that? 如果我想通过打印出值来测试事情,Delve不支持吗?

在调试控制台中,输入foo (不带po前缀)

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

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