Skip to content

Commit

Permalink
Merge pull request #629 from tariq1890/fix-more-lints
Browse files Browse the repository at this point in the history
[golangci-lint] fix implicit memory aliasing in for loop
  • Loading branch information
tariq1890 authored Apr 12, 2024
2 parents a86047a + 58563a4 commit e120009
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 2 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 10m
timeout: 10m

linters:
enable:
Expand Down Expand Up @@ -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"
text: "G306: Expect WriteFile permissions to be 0600 or less"
3 changes: 2 additions & 1 deletion internal/plugin/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ package e2e

import (
"flag"
"math/rand"
"os"
"testing"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -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())
}

Expand Down

0 comments on commit e120009

Please sign in to comment.