I have some go tests. I would like to debug with gdb.
But the binaries built by go test
are thrown away after running.
So how do I do it?
go 1.6 on windows/64
You use go test -c
which will produce the executable file xyz.test
. Afterwards you use gdb xyz.test
to debug.
Just check go test --help
for an explanation of the -c
flag:
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.