func TestMyFunction(t *testing.T) { if myFunction() != 42 { t.Log("myFunction did not return 42") t.Fail() } }There are also other methods available in the testing.T type, such as Error and Fatal, which allow you to set the test status to fail or exit the test immediately, respectively. The testing.T Log method is part of the standard library in Go, and is contained within the "testing" package.