diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc6eafeb..f4c3ecc28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v3 - uses: golangci/golangci-lint-action@v3 with: - version: v1.52.2 + version: v1.54.2 skip-cache: true args: --timeout=8m diff --git a/content/helpers_test.go b/content/helpers_test.go index 4bfddc503..d221d39f2 100644 --- a/content/helpers_test.go +++ b/content/helpers_test.go @@ -143,6 +143,7 @@ func TestCopy(t *testing.T) { } for _, testcase := range testcases { + testcase := testcase t.Run(testcase.name, func(t *testing.T) { err := Copy(context.Background(), &testcase.writer, diff --git a/metadata/containers_test.go b/metadata/containers_test.go index 7067b4f20..56a88648b 100644 --- a/metadata/containers_test.go +++ b/metadata/containers_test.go @@ -619,6 +619,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) { }, }, } { + testcase := testcase t.Run(testcase.name, func(t *testing.T) { testcase.original.ID = testcase.name if testcase.input.ID == "" { diff --git a/metadata/images_test.go b/metadata/images_test.go index 4644e0018..8d3ae878e 100644 --- a/metadata/images_test.go +++ b/metadata/images_test.go @@ -479,6 +479,7 @@ func TestImagesCreateUpdateDelete(t *testing.T) { cause: errdefs.ErrNotFound, }, } { + testcase := testcase t.Run(testcase.name, func(t *testing.T) { testcase.original.Name = testcase.name if testcase.input.Name == "" { diff --git a/metrics/cgroups/v1/oom.go b/metrics/cgroups/v1/oom.go index 8660c61b5..b580281a7 100644 --- a/metrics/cgroups/v1/oom.go +++ b/metrics/cgroups/v1/oom.go @@ -98,6 +98,7 @@ func (o *oomCollector) Collect(ch chan<- prometheus.Metric) { o.mu.Lock() defer o.mu.Unlock() for _, t := range o.set { + t := t c := atomic.LoadInt64(&t.count) ch <- prometheus.MustNewConstMetric(o.desc, prometheus.CounterValue, float64(c), t.id, t.namespace) } diff --git a/pkg/cri/sbserver/images/image_status_test.go b/pkg/cri/sbserver/images/image_status_test.go index d4ea0b382..31d756994 100644 --- a/pkg/cri/sbserver/images/image_status_test.go +++ b/pkg/cri/sbserver/images/image_status_test.go @@ -29,7 +29,7 @@ import ( ) func TestImageStatus(t *testing.T) { - testID := "sha256:d848ce12891bf78792cda4a23c58984033b0c397a55e93a1556202222ecc5ed4" + testID := "sha256:d848ce12891bf78792cda4a23c58984033b0c397a55e93a1556202222ecc5ed4" // #nosec G101 image := imagestore.Image{ ID: testID, ChainID: "test-chain-id", diff --git a/pkg/cri/sbserver/images/service_test.go b/pkg/cri/sbserver/images/service_test.go index e1208169b..bf480bbab 100644 --- a/pkg/cri/sbserver/images/service_test.go +++ b/pkg/cri/sbserver/images/service_test.go @@ -35,7 +35,7 @@ const ( // Use an image id as test sandbox image to avoid image name resolve. // TODO(random-liu): Change this to image name after we have complete image // management unit test framework. - testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" + testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" // #nosec G101 ) // newTestCRIService creates a fake criService for test. diff --git a/pkg/cri/sbserver/podsandbox/controller_test.go b/pkg/cri/sbserver/podsandbox/controller_test.go index 4a3decc2c..b6a7f2c3a 100644 --- a/pkg/cri/sbserver/podsandbox/controller_test.go +++ b/pkg/cri/sbserver/podsandbox/controller_test.go @@ -34,7 +34,7 @@ const ( // Use an image id as test sandbox image to avoid image name resolve. // TODO(random-liu): Change this to image name after we have complete image // management unit test framework. - testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" + testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" // #nosec G101 ) var testConfig = criconfig.Config{ diff --git a/pkg/cri/sbserver/test_config.go b/pkg/cri/sbserver/test_config.go index 5a9a3b3c0..44908435b 100644 --- a/pkg/cri/sbserver/test_config.go +++ b/pkg/cri/sbserver/test_config.go @@ -24,7 +24,7 @@ const ( // Use an image id as test sandbox image to avoid image name resolve. // TODO(random-liu): Change this to image name after we have complete image // management unit test framework. - testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" + testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" // #nosec G101 ) var testConfig = criconfig.Config{ diff --git a/pkg/cri/server/image_status_test.go b/pkg/cri/server/image_status_test.go index 884f0f2e0..fdc44ea41 100644 --- a/pkg/cri/server/image_status_test.go +++ b/pkg/cri/server/image_status_test.go @@ -29,7 +29,7 @@ import ( ) func TestImageStatus(t *testing.T) { - testID := "sha256:d848ce12891bf78792cda4a23c58984033b0c397a55e93a1556202222ecc5ed4" + testID := "sha256:d848ce12891bf78792cda4a23c58984033b0c397a55e93a1556202222ecc5ed4" // #nosec G101 image := imagestore.Image{ ID: testID, ChainID: "test-chain-id", diff --git a/pkg/cri/server/test_config.go b/pkg/cri/server/test_config.go index c129e38fc..a2e663ab7 100644 --- a/pkg/cri/server/test_config.go +++ b/pkg/cri/server/test_config.go @@ -24,7 +24,7 @@ const ( // Use an image id as test sandbox image to avoid image name resolve. // TODO(random-liu): Change this to image name after we have complete image // management unit test framework. - testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" + testSandboxImage = "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798" // #nosec G101 testImageFSPath = "/test/image/fs/path" ) diff --git a/script/setup/install-dev-tools b/script/setup/install-dev-tools index 9e1e9a132..666352636 100755 --- a/script/setup/install-dev-tools +++ b/script/setup/install-dev-tools @@ -23,7 +23,7 @@ set -eu -o pipefail go install github.com/containerd/protobuild@v0.3.0 go install github.com/containerd/protobuild/cmd/go-fix-acronym@v0.3.0 go install github.com/cpuguy83/go-md2man/v2@v2.0.2 -go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 +go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 go install github.com/containerd/ttrpc/cmd/protoc-gen-go-ttrpc@5cc9169d1fc1a8292866224ae09dc47827801874 diff --git a/tracing/plugin/otlp_test.go b/tracing/plugin/otlp_test.go index 89f1af4c0..510685471 100644 --- a/tracing/plugin/otlp_test.go +++ b/tracing/plugin/otlp_test.go @@ -70,6 +70,7 @@ func TestNewExporter(t *testing.T) { output: errdefs.ErrNotImplemented, }, } { + testcase := testcase t.Run(testcase.name, func(t *testing.T) { t.Logf("input: %v", testcase.input)