From 476293170df2c8f82949f53d00df2823bc9c5760 Mon Sep 17 00:00:00 2001 From: Carlos Panato Date: Sat, 9 Aug 2025 18:26:44 +0100 Subject: [PATCH 1/2] bump golangci-lint and allow release-assets.githubusercontent.com Signed-off-by: Carlos Panato --- .github/workflows/codeql-analysis.yml | 1 + .github/workflows/lint.yml | 2 +- .golangci.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 639916e4f56..e7d8b9d0ce0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,6 +51,7 @@ jobs: sum.golang.org:443 uploads.github.com:443 objects.githubusercontent.com:443 + release-assets.githubusercontent.com:443 - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 49a334cca73..089cbafdc9e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,4 +32,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2.1 + version: v2.3 diff --git a/.golangci.yml b/.golangci.yml index 75d40473423..d7355d19003 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,7 +81,7 @@ linters: - usetesting - wastedassign - whitespace - - wsl + - wsl_v5 - zerologlint # - cyclop # - depguard From 53d7ee85763b785889d3a116b95a4014cfddb94b Mon Sep 17 00:00:00 2001 From: Carlos Panato Date: Sat, 9 Aug 2025 18:26:57 +0100 Subject: [PATCH 2/2] fix lints Signed-off-by: Carlos Panato --- cmd/krel/cmd/sign_blobs.go | 1 + cmd/publish-release/cmd/github_test.go | 2 ++ dependencies.yaml | 2 +- pkg/binary/binary_unit_test.go | 1 + pkg/gcp/build/build.go | 2 ++ pkg/notes/document/document_test.go | 1 + pkg/notes/notes.go | 2 ++ pkg/release/publish.go | 1 + pkg/testgrid/testgrid-scraper.go | 2 ++ 9 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/krel/cmd/sign_blobs.go b/cmd/krel/cmd/sign_blobs.go index 9b9b184f6c7..ec38acd0744 100644 --- a/cmd/krel/cmd/sign_blobs.go +++ b/cmd/krel/cmd/sign_blobs.go @@ -141,6 +141,7 @@ func runSignBlobs(signOpts *signOptions, signBlobOpts *signBlobOptions, args []s } var tempDir string + defer func() { if tempDir != "" { os.RemoveAll(tempDir) diff --git a/cmd/publish-release/cmd/github_test.go b/cmd/publish-release/cmd/github_test.go index 8cbbe2b938d..069da3c5607 100644 --- a/cmd/publish-release/cmd/github_test.go +++ b/cmd/publish-release/cmd/github_test.go @@ -30,9 +30,11 @@ func TestProcessRemoteAsset(t *testing.T) { prev := os.Getenv(gacVar) defer t.Setenv(gacVar, prev) + t.Setenv(gacVar, "") files := []string{} + defer func() { for _, f := range files { os.RemoveAll(f) diff --git a/dependencies.yaml b/dependencies.yaml index 4db5ddd6023..a4c090d7586 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -408,7 +408,7 @@ dependencies: # golangci-lint-version - name: "golangci-lint" - version: v2.1 + version: v2.3 refPaths: - path: .github/workflows/lint.yml match: "version: v\\d+.\\d+?\\.?(\\d+)?" diff --git a/pkg/binary/binary_unit_test.go b/pkg/binary/binary_unit_test.go index eb2b39af442..ebb59089854 100644 --- a/pkg/binary/binary_unit_test.go +++ b/pkg/binary/binary_unit_test.go @@ -27,6 +27,7 @@ import ( func TestContainsString(t *testing.T) { tmpfile, err := os.CreateTemp(t.TempDir(), "") require.NoError(t, err) + defer os.Remove(tmpfile.Name()) // Decode a fragment of kubectl into a temporary file: diff --git a/pkg/gcp/build/build.go b/pkg/gcp/build/build.go index aa57d65cdbb..e7071ed59fa 100644 --- a/pkg/gcp/build/build.go +++ b/pkg/gcp/build/build.go @@ -254,6 +254,7 @@ func RunSingleJob(o *Options, jobName, uploaded, version string, subs map[string } defer f.Close() + cmd.AddWriter(f) } @@ -362,6 +363,7 @@ func RunBuildJobs(o *Options) []error { for k, v := range vs { go func(job string, vc map[string]string) { defer w.Done() + logrus.Infof("Starting job %q...", job) if err := RunSingleJob(o, job, uploaded, tag, mergeMaps(extraSubs, vc)); err != nil { diff --git a/pkg/notes/document/document_test.go b/pkg/notes/document/document_test.go index 03d29eca93c..7df52803852 100644 --- a/pkg/notes/document/document_test.go +++ b/pkg/notes/document/document_test.go @@ -279,6 +279,7 @@ func setupTestDir(t *testing.T, dir string) { func repoTagTarball(t *testing.T, path, repoTag string) { const manifestJSON = "manifest.json" + manifestJSONPath := filepath.Join(filepath.Dir(path), manifestJSON) require.NoError(t, os.WriteFile( manifestJSONPath, diff --git a/pkg/notes/notes.go b/pkg/notes/notes.go index 4545b3e23e9..759c91e06e7 100644 --- a/pkg/notes/notes.go +++ b/pkg/notes/notes.go @@ -653,6 +653,7 @@ type commitList struct { func (l *commitList) Add(c []*gogithub.RepositoryCommit) { l.Lock() defer l.Unlock() + l.list = append(l.list, c...) } @@ -917,6 +918,7 @@ type resultList struct { func (l *resultList) Add(r *Result) { l.Lock() defer l.Unlock() + l.list = append(l.list, r) } diff --git a/pkg/release/publish.go b/pkg/release/publish.go index 87c0d6186f3..d6bc7072a23 100644 --- a/pkg/release/publish.go +++ b/pkg/release/publish.go @@ -465,6 +465,7 @@ func (p *Publisher) PublishReleaseNotesIndex( } defer os.RemoveAll(tempDir) + tempIndexFile := filepath.Join(tempDir, releaseNotesIndex) if err := p.client.CopyToLocal( diff --git a/pkg/testgrid/testgrid-scraper.go b/pkg/testgrid/testgrid-scraper.go index a517585d71a..055c30c7939 100644 --- a/pkg/testgrid/testgrid-scraper.go +++ b/pkg/testgrid/testgrid-scraper.go @@ -40,6 +40,7 @@ func ReqTestgridDashboardSummaries(ctx context.Context, dashboardNames []Dashboa // Worker requestData := func(done <-chan interface{}, dashboardNames ...DashboardName) <-chan SummaryLookup { summaryLookups := make(chan SummaryLookup) + go func() { defer close(summaryLookups) @@ -163,6 +164,7 @@ func (d *JobData) Overview() (Overview, error) { // UnmarshalTestgridSummary used to unmarshal bytes into TestgridSummary. func UnmarshalTestgridSummary(data []byte) (JobData, error) { var r JobData + err := json.Unmarshal(data, &r) return r, err