Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Commit 618fe8f

Browse files
committed
initial 2
1 parent a872672 commit 618fe8f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

instrumentation/testing/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ func Init(m *testing.M) {
7070
var err error
7171
runPatch, err = mpatch.PatchMethodByReflect(tRunMethod, func(t *testing.T, name string, f func(t *testing.T)) bool {
7272
logOnError(runPatch.Unpatch())
73-
defer func() {
74-
logOnError(runPatch.Patch())
75-
}()
73+
defer func() { logOnError(runPatch.Patch()) }()
7674
pc, _, _, _ := runtime.Caller(1)
7775
return t.Run(name, func(childT *testing.T) {
76+
logOnError(runPatch.Patch())
77+
defer func() { logOnError(runPatch.Unpatch()) }()
7878
addAutoInstrumentedTest(childT)
7979
childTest := StartTestFromCaller(childT, pc)
8080
defer childTest.end()

instrumentation/testing/logger.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package testing
22

33
import (
4+
"fmt"
45
"reflect"
56
"sync"
67
"testing"
@@ -159,6 +160,7 @@ func patch(methodName string, methodBody func(test *Test, argsValues []reflect.V
159160
func logOnError(err error) {
160161
if err != nil {
161162
instrumentation.Logger().Println(err)
163+
fmt.Println(err)
162164
}
163165
}
164166

0 commit comments

Comments
 (0)