From 58563a42c59dc6e95a8fb5df3ab3e08c8399bbd4 Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Fri, 12 Apr 2024 09:48:59 -0700 Subject: [PATCH] [golangci-lint] fix implicit memory aliasing in for loop Signed-off-by: Tariq Ibrahim --- .golangci.yml | 9 ++------- internal/plugin/server_test.go | 3 ++- tests/e2e/e2e_test.go | 3 --- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a0164fd1c..22d53eda1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - deadline: 10m + timeout: 10m linters: enable: @@ -28,13 +28,8 @@ issues: linters: - gosec text: "G404" - # We disable the memory aliasing checks in tests - - path: ".*_test.go" - linters: - - gosec - text: "G601: Implicit memory aliasing in for loop" # We create world-readable files in tests. - path: ".*_test.go" linters: - gosec - text: "G306: Expect WriteFile permissions to be 0600 or less" \ No newline at end of file + text: "G306: Expect WriteFile permissions to be 0600 or less" diff --git a/internal/plugin/server_test.go b/internal/plugin/server_test.go index a97c5aa55..2012fe908 100644 --- a/internal/plugin/server_test.go +++ b/internal/plugin/server_test.go @@ -131,7 +131,8 @@ func TestCDIAllocateResponse(t *testing.T) { }, } - for _, tc := range testCases { + for i := range testCases { + tc := testCases[i] t.Run(tc.description, func(t *testing.T) { deviceListStrategies, _ := v1.NewDeviceListStrategies(tc.deviceListStrategies) plugin := NvidiaDevicePlugin{ diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index db9c48baa..f80098e67 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -18,10 +18,8 @@ package e2e import ( "flag" - "math/rand" "os" "testing" - "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" @@ -52,7 +50,6 @@ func TestMain(m *testing.M) { e2elog.Failf("Required flags not set. Please set -image.repo, -image.tag and -helm-chart") } - rand.New(rand.NewSource(time.Now().UnixNano())) os.Exit(m.Run()) }