diff --git a/pkg/clusteragent/admission/mutate/auto_instrumentation.go b/pkg/clusteragent/admission/mutate/auto_instrumentation.go index f621346b692a7..daee6472ef5c0 100644 --- a/pkg/clusteragent/admission/mutate/auto_instrumentation.go +++ b/pkg/clusteragent/admission/mutate/auto_instrumentation.go @@ -80,7 +80,7 @@ type language string type pinnedLibraries struct { libraries []libInfo - once *sync.Once + once sync.Once } const ( diff --git a/pkg/clusteragent/admission/mutate/auto_instrumentation_test.go b/pkg/clusteragent/admission/mutate/auto_instrumentation_test.go index d862f54393174..2e1f72c09e284 100644 --- a/pkg/clusteragent/admission/mutate/auto_instrumentation_test.go +++ b/pkg/clusteragent/admission/mutate/auto_instrumentation_test.go @@ -12,7 +12,6 @@ import ( "os" "strconv" "strings" - "sync" "testing" "time" @@ -575,8 +574,7 @@ func TestExtractLibInfo(t *testing.T) { } // reset pinned libraries between test runs - pinnedLibs.once = new(sync.Once) - pinnedLibs.libraries = []libInfo{} + pinnedLibs = &pinnedLibraries{} apmInstrumentation, err := newAPMInstrumentationWebhook() require.NoError(t, err) @@ -1848,8 +1846,7 @@ func TestInjectAutoInstrumentation(t *testing.T) { fakeStoreWithDeployment(t, tt.langDetectionDeployments) // reset pinned libraries between test runs - pinnedLibs.once = new(sync.Once) - pinnedLibs.libraries = []libInfo{} + pinnedLibs = &pinnedLibraries{} apmInstrumentation, err := newAPMInstrumentationWebhook() require.NoError(t, err)