go - 如何使用 gdb 调试 go 测试

标签 go

我有一些围棋测试。我想用 gdb 调试。

但是go test构建的二进制文件运行后就被扔掉了。

那我该怎么做呢?

在 windows/64 上运行 1.6

最佳答案

您使用 go test -c 将生成可执行文件 xyz.test。然后使用 gdb xyz.test 进行调试。

只需检查 go test --help 以获取对 -c 标志的解释:

Compile the test binary to pkg.test but do not run it (where pkg is the last element of the package's import path). The file name can be changed with the -o flag.

关于go - 如何使用 gdb 调试 go 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36223429/

相关文章:

go - `-X` 的参数中 `go build -ldflags` 的含义是什么?

json - 我该怎么做呢?将结构作为接口(interface)发送到函数并将其作为结构取回?

network-programming - golang 提供 htonl/htons 吗?

go - 尝试提供 Gin Gonic 应用程序时出现紧急错误

java - Golang 和大内存块分配

go - 如何在同一包中的多个源之间共享聚合类型(例如自定义结构)

go - 范围使用是否需要 channel 容量?

mongodb - 使用 := gives unused error but using = don't in Go

go - 在模板之间传递数据

go - 如何创建本地 VGO 应用程序模块