I can use t.Log to print messages inside my test functions, and use test -v
to see those messages during testing. But how do I print a message from
inside init() inside my test file? And similarly, how do I print test
messages inside my package functions and package init()?
I want to do this because I want to know when those functions are entered
during testing (and in what sequence).
For example, I want to print a message during testing everywhere there is
an XXX in these files:
foo.go:
package main
func init() {
// XXX
}
func Bar() {
// XXX
}
func main() {
Bar()
}
foo_test.go:
package main
import "testing"
func init() {
// XXX
}
func TestFoo(t *testing.T) {
t.Log("inside TestFoo() in foo_test.go")
}
Any ideas how I can accomplish this?
Many thanks!
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.