You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级MacOS Sequoia后VSCode调试Go测试报错求助

解决MacOS Sequoia下VSCode调试Go测试的DWARF错误

问题背景

升级MacOS至Sequoia后,使用VSCode调试Go测试时出现以下错误:

Failed to launch: could not launch process: error reading debug_info: decoding dwarf section info at offset 0xac6f38: DW_FORM_strx with no .debug_str_offsets section

环境配置:dlv 1.23.0,Go 1.22.7 darwin/arm64,已尝试-gcflags="all=-N -l"、重装Go和dlv但未解决。

解决办法

  • 升级Delve到最新兼容版本
    旧版dlv对Sequoia的DWARF格式支持存在问题,执行以下命令安装最新版:

    go install github.com/go-delve/delve/cmd/dlv@latest
    

    安装完成后替换系统中旧的dlv可执行文件。

  • 升级Go到最新稳定版
    Go 1.22.7未针对Sequoia做适配,升级到官方最新稳定版(如1.23.x),重新安装后重新编译测试代码。

  • 调整VSCode调试配置
    在项目的.vscode/launch.json中修改调试配置,添加dlvFlags跳过版本检查:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch Test",
                "type": "go",
                "request": "launch",
                "mode": "test",
                "program": "${file}",
                "dlvFlags": ["--check-go-version=false"]
            }
        ]
    }
    
  • 清理Go缓存
    执行以下命令清理模块缓存和编译缓存,避免旧缓存导致的兼容性问题:

    go clean -modcache
    go clean -cache
    
  • 更新VSCode Go插件
    在VSCode扩展市场中找到「Go」插件(由Go Team at Google开发),检查并更新到最新版本,新版本通常会修复新系统的适配问题。

内容的提问来源于stack exchange,提问作者Harith Laxman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 10:03:17