问题描述:
使用vscode配置debug环境,调试go的项目时,遇到字符串只显示了一部分,剩下的显示为"..."。
解决方法:
修改vscode的debug配置:
在configurations中增加如下配置,修改"maxStringLen"字段值为自己想要的长度,默认64,这里修改为521。注意其他默认字段不能省略,使用默认值即可:
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 1,
"maxStringLen": 512, //字符串最大长度
"maxArrayValues": 64,
"maxStructFields": -1
}
添加后的配置效果如下:
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "",
"env": {},
"args": [],
"cwd":"",
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 1,
"maxStringLen": 512, //字符串最大长度
"maxArrayValues": 64,
"maxStructFields": -1
}
}]
参考资料: