解决mac arm 中 goland 无法 debug 问题

发布时间 2024-01-10 14:01:23作者: CK..Soul

新电脑不知道装了什么,导致无法debug

现象

  1. 可以run,没有问题
  2. 不能debug,报错信息如下
    单元测试报错
^Cgo tool test2json: signal: interrupt

main 方法debug报错

^Ccould not launch process: stub exited while waiting for connection: signal: interrupt

解决之路

  1. 网上找遍了方法,有重新安装 go sdk -- 没用
  2. 重新安装xcode-select 工具包 -- 没用
  3. 把另一台电脑二进制移过来 -- 没用

最后解决

参考 https://youtrack.jetbrains.com/issue/GO-13561/go-test-debug-failed#focus=Comments-27-6430597.0-0 进行一步一步调试

在最后有建议设置两个goland的配置

Disable go.debugger.configure.pty.for.tests https://youtrack.jetbrains.com/issue/GO-13561/go-test-debug-failed#focus=Comments-27-6430597.0-0 , but this will cause "too many colons" in listen address
Disable ipv6, "Edit custom VM options..." --> Add -Djava.net.preferIPv4Stack=true and remove all lines that has *ipv6Stack*

在设置完后重新运行 debug, 解决问题