diff --git a/.github/workflows/pre-submit.lint.yml b/.github/workflows/pre-submit.lint.yml index 86293b1791..76eca508ae 100644 --- a/.github/workflows/pre-submit.lint.yml +++ b/.github/workflows/pre-submit.lint.yml @@ -87,8 +87,8 @@ jobs: with: go-version-file: "go.mod" - env: - GOLANGCI_LINT_VERSION: "1.60.3" - GOLANGCI_LINT_CHECKSUM: "4037af8122871f401ed874852a471e54f147ff8ce80f5a304e020503bdb806ef" + GOLANGCI_LINT_VERSION: "1.61.0" + GOLANGCI_LINT_CHECKSUM: "77cb0af99379d9a21d5dc8c38364d060e864a01bd2f3e30b5e8cc550c3a54111" run: | set -euo pipefail diff --git a/.golangci.yml b/.golangci.yml index 2459527c5f..6224688138 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,7 +45,7 @@ linters: # TODO(github.com/slsa-framework/slsa-github-generator/issues/450): enable errorlint # - errorlint - exhaustive - - exportloopref + - copyloopvar # TODO(github.com/slsa-framework/slsa-github-generator/issues/450): enable gci # - gci - gochecknoinits diff --git a/go.mod b/go.mod index 2a778d3515..e1e226b054 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/slsa-framework/slsa-github-generator -go 1.22.5 - -toolchain go1.23.0 +go 1.23.1 require ( github.com/coreos/go-oidc/v3 v3.11.0 diff --git a/internal/builders/go/e2e-presubmits/go.mod b/internal/builders/go/e2e-presubmits/go.mod index fddbfea4a0..63b25762cd 100644 --- a/internal/builders/go/e2e-presubmits/go.mod +++ b/internal/builders/go/e2e-presubmits/go.mod @@ -1,6 +1,6 @@ module slsa-framework/example-package -go 1.21 +go 1.23.1 require github.com/pborman/uuid v1.2.1 diff --git a/internal/builders/go/main_test.go b/internal/builders/go/main_test.go index 0d478a9511..f1a692b524 100644 --- a/internal/builders/go/main_test.go +++ b/internal/builders/go/main_test.go @@ -298,7 +298,6 @@ func Test_runBuild(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { // *** WARNING: do not enable t.Parallel(), because we're writing to environment variables ***. file, err := os.CreateTemp("", "") diff --git a/internal/builders/go/pkg/build_test.go b/internal/builders/go/pkg/build_test.go index 4673a6683f..3448e27d71 100644 --- a/internal/builders/go/pkg/build_test.go +++ b/internal/builders/go/pkg/build_test.go @@ -90,7 +90,6 @@ func Test_isAllowedEnvVariable(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -126,7 +125,6 @@ func Test_getOutputBinaryPath(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -177,7 +175,6 @@ func Test_isAllowedArg(t *testing.T) { }) } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -442,7 +439,6 @@ func Test_generateOutputFilename(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { // Note: disable parallelism to avoid env variable clobbering between tests. // t.Parallel() @@ -595,7 +591,6 @@ func Test_SetArgEnvVariables(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -704,7 +699,6 @@ func Test_generateEnvVariables(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -862,7 +856,6 @@ func Test_generateLdflags(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { // Disable to avoid env clobbering between tests. // t.Parallel() @@ -954,7 +947,6 @@ func Test_generateFlags(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1024,7 +1016,6 @@ func Test_generateCommand(t *testing.T) { } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/builders/go/pkg/config_test.go b/internal/builders/go/pkg/config_test.go index 270c242e03..88180aaac4 100644 --- a/internal/builders/go/pkg/config_test.go +++ b/internal/builders/go/pkg/config_test.go @@ -185,7 +185,6 @@ func Test_ConfigFromFile(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/builders/go/pkg/testdata/go/go.mod b/internal/builders/go/pkg/testdata/go/go.mod index 5e56a47970..1c6491398f 100644 --- a/internal/builders/go/pkg/testdata/go/go.mod +++ b/internal/builders/go/pkg/testdata/go/go.mod @@ -1,3 +1,3 @@ module github.com/slsa-framework/slsa-github-generator/internal/builders/go/pkg/testdata/go -go 1.19 +go 1.23.1 diff --git a/internal/utils/marshal_test.go b/internal/utils/marshal_test.go index 91e75d8f08..244c6bcee3 100644 --- a/internal/utils/marshal_test.go +++ b/internal/utils/marshal_test.go @@ -46,7 +46,6 @@ func Test_MarshalToString(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -91,7 +90,6 @@ func Test_UnmarshalList(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/utils/path_test.go b/internal/utils/path_test.go index e810ea2d08..ffd9c930b2 100644 --- a/internal/utils/path_test.go +++ b/internal/utils/path_test.go @@ -69,7 +69,6 @@ func Test_PathIsUnderCurrentDirectory(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -121,7 +120,6 @@ func Test_VerifyAttestationPath(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -193,7 +191,6 @@ func Test_CreateNewFileUnderCurrentDirectory(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { cleanup, err := tempWD() if err != nil { @@ -273,7 +270,6 @@ func Test_PathIsUnderDirectory(t *testing.T) { }, } for _, tt := range tests { - tt := tt // Re-initializing variable so it is not changed while executing the closure below t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/signing/sigstore/rekor.go b/signing/sigstore/rekor.go index 0dd2bc2c69..1a08370451 100644 --- a/signing/sigstore/rekor.go +++ b/signing/sigstore/rekor.go @@ -99,8 +99,6 @@ func (r *Rekor) Upload(ctx context.Context, att signing.Attestation) (signing.Lo var uuid string for ix, entry := range resp.Payload { - entry := entry - if err := cosign.VerifyTLogEntryOffline(ctx, &entry, pubs); err != nil { return nil, fmt.Errorf("validating log entry: %w", err) }