Smarties89
Smarties89

Reputation: 561

Stopping running unit tests, and get logging

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.

Upvotes: 2

Views: 74

Answers (2)

Peter Stace
Peter Stace

Reputation: 1434

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.

Upvotes: 1

Evan
Evan

Reputation: 6545

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.

Upvotes: 1

Related Questions