Skip to content

Fix golangci-lint failures in codemod and miner test files#31590

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-lint-go-failure
May 11, 2026
Merged

Fix golangci-lint failures in codemod and miner test files#31590
pelikhan merged 2 commits into
mainfrom
copilot/fix-lint-go-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

Bug Fix

What was the bug?

The lint-go CI job was failing with 7 golangci-lint violations across three files introduced by recent changes.

How did you fix it?

pkg/cli/codemod_checkout_persist_credentials_false.go

  • intrange: replaced C-style loop with for i := range stepLines
  • wastedassign: moved isUsesInline and withKeyIndentLen declarations into the if blocks where they're first assigned and used, eliminating dead initial values
  • perfsprint: replaced fmt.Sprintf("%spersist-credentials: false", withIndent+" ") with withIndent + " persist-credentials: false"; removed unused "fmt" import

pkg/cli/codemod_checkout_persist_credentials_false_fuzz_test.go

  • perfsprint: replaced two fmt.Sprintf("...: %s", x) calls with string concatenation; removed unused "fmt" import

pkg/agentdrain/miner_test.go

  • testifylint: swapped require.NoErrorassert.NoError inside a goroutine — require calls runtime.Goexit() which doesn't behave correctly outside the test goroutine

…lint

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job lint-go Fix golangci-lint failures in codemod and miner test files May 11, 2026
Copilot AI requested a review from pelikhan May 11, 2026 22:12
@pelikhan pelikhan marked this pull request as ready for review May 11, 2026 22:30
Copilot AI review requested due to automatic review settings May 11, 2026 22:30
@pelikhan pelikhan merged commit 6d136d0 into main May 11, 2026
@pelikhan pelikhan deleted the copilot/fix-lint-go-failure branch May 11, 2026 22:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes golangci-lint violations that were causing the lint-go CI job to fail, without changing the intended runtime behavior.

Changes:

  • Refactors the codemod implementation to remove intrange, wastedassign, and perfsprint lint violations (including dropping an unused fmt import).
  • Updates the codemod fuzz test to avoid unnecessary fmt.Sprintf usage and remove the unused fmt import.
  • Replaces require.NoError with assert.NoError inside a goroutine in TestConcurrency to avoid runtime.Goexit() behavior from non-test goroutines.
Show a summary per file
File Description
pkg/cli/codemod_checkout_persist_credentials_false.go Refactors loop/assignments and simplifies string construction to satisfy golangci-lint.
pkg/cli/codemod_checkout_persist_credentials_false_fuzz_test.go Removes fmt.Sprintf usage and unused import in fuzz test helper.
pkg/agentdrain/miner_test.go Avoids require.* assertions inside goroutines by switching to assert.*.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants