美文网首页
VSCode 调试 Go 语言坑(一)

VSCode 调试 Go 语言坑(一)

作者: chenj23986526 | 来源:发表于2019-04-02 10:39 被阅读0次

描述

在调试过程中,如果字符串变量长度超过64,打印变量不会显示全部

关键字

  • vscode debugging string truncated
  • Long strings are truncated to
  • Long strings in variable inspection get truncated
  • Debug console truncates strings longer than 64 characters

解决办法

  1. 先升级 delve,确保使用 v2 版本
    Ctrl+Shift+P --> Go: Install/Update Tools --> dlv --> ok
  2. 在 launch.json 增加配置(长度可设置大一点)
    "dlvLoadConfig": {
        "maxStringLen": 10000,
    }
    
  3. 若不想每次都设置 launch.json,可添加在 settings.json 中
    "go.delveConfig": {
        "dlvLoadConfig": {
            "maxStringLen": 10000,
        }
    }
    

参考

Debugging Go code using VS Code
delve

相关文章

网友评论

      本文标题:VSCode 调试 Go 语言坑(一)

      本文链接:https://www.haomeiwen.com/subject/rqswbqtx.html