From 36878a94237601370d8cf2f9147d8f87d8e21ac9 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Thu, 7 Mar 2024 12:18:23 +0100 Subject: [PATCH] Skip the G601 tests for Go version 1.22 Signed-off-by: Cosmin Cojocar --- rules/rules_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/rules_test.go b/rules/rules_test.go index 9aa3971..074e5c4 100644 --- a/rules/rules_test.go +++ b/rules/rules_test.go @@ -192,7 +192,10 @@ var _ = Describe("gosec rules", func() { }) It("should detect implicit aliasing in ForRange", func() { - runner("G601", testutils.SampleCodeG601) + major, minor, _ := gosec.GoVersion() + if major <= 1 && minor < 22 { + runner("G601", testutils.SampleCodeG601) + } }) It("should detect out of bounds slice access", func() {