From 20fff049f10a038d10372e97fa33b436a76a9144 Mon Sep 17 00:00:00 2001 From: Daniel Redondo Date: Tue, 14 Apr 2020 18:49:32 +0200 Subject: [PATCH] Nil check in SetTestCode func --- instrumentation/testing/testing.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/instrumentation/testing/testing.go b/instrumentation/testing/testing.go index 16a7ca30..c1e30124 100644 --- a/instrumentation/testing/testing.go +++ b/instrumentation/testing/testing.go @@ -106,6 +106,10 @@ func StartTestFromCaller(t *testing.T, pc uintptr, opts ...Option) *Test { // Set test code func (test *Test) SetTestCode(pc uintptr) { + test.codePC = pc + if test.span == nil { + return + } pName, _, fBoundaries := getPackageAndNameAndBoundaries(pc) test.span.SetTag("test.suite", pName) if fBoundaries != "" {