gpt4 book ai didi

debugging - 如何在 delve 中打印字符串变量的完整值?

转载 作者:IT王子 更新时间:2023-10-29 01:34:38 25 4
gpt4 key购买 nike

我正在使用 delve go 调试器来调试一些代码。当我尝试打印一个字符串变量时,它给了我一个缩写版本。

(dlv) print myString
"my string...+539 more"

如何让它打印完整的字符串?

最佳答案

配置打印字符串长度的功能最近被添加到 delve 中。查看 configuration options 的完整列表, 运行 config -list ;

(dlv) config -list
aliases map[]
substitute-path []
max-string-len <not defined>
max-array-values <not defined>
show-location-expr false

我们在这里感兴趣的是 max-string-len , 你可以看到当前是 <not defined> .将长度增加到例如1000,运行

(dlv) config max-string-len 1000

正在运行 print myString应该打印整个字符串。

关于debugging - 如何在 delve 中打印字符串变量的完整值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52416263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com