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

Commit 8f876c6

Browse files
committed
changes
1 parent 8f811aa commit 8f876c6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

instrumentation/testing/init.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ func Init(m *testing.M) {
5656
var runPatch *mpatch.Patch
5757
var err error
5858
runPatch, err = mpatch.PatchMethodByReflect(tRunMethod, func(t *testing.T, name string, f func(t *testing.T)) bool {
59-
logOnError(runPatch.Unpatch())
60-
defer func() { logOnError(runPatch.Patch()) }()
6159
pc, _, _, _ := runtime.Caller(1)
60+
logOnError(runPatch.Unpatch())
61+
defer runPatch.Patch()
6262
return t.Run(name, func(childT *testing.T) {
63-
logOnError(runPatch.Patch())
64-
defer func() { logOnError(runPatch.Unpatch()) }()
63+
_ = runPatch.Patch()
6564
addAutoInstrumentedTest(childT)
6665
childTest := StartTestFromCaller(childT, pc)
6766
defer childTest.end()

0 commit comments

Comments
 (0)