停止正在运行的单元测试并获取日志

I have some unit test that deadlocks for some reason. I want to stop the running unit test, and see the messages(t.Log). If I just do CTRL-C I don't get the messages.

You can do CTRL-\ and it will give you a backtrace of where it's hung. I'm not sure if there's a clean way to get the log messages though.

You should use the -v flag with go test, e.g. go test -v github.com/myname/package

This will cause the any logging to be output as the tests are run.