Skip to content

fix: remove unused git helper functions causing lint-go CI failure#19189

Merged
pelikhan merged 2 commits intomainfrom
copilot/remove-unused-git-helper-functions
Mar 2, 2026
Merged

fix: remove unused git helper functions causing lint-go CI failure#19189
pelikhan merged 2 commits intomainfrom
copilot/remove-unused-git-helper-functions

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

golangci-lint's unused check was blocking CI because five dead functions in pkg/cli/git.go had no callers.

Changes

  • Removed pullFromRemote, pushToRemote, and commitAndPushChanges — flagged directly by lint
  • Removed hasChangesToCommit and hasRemote — became orphaned once commitAndPushChanges (their sole caller) was deleted
  • Kept stageAllChanges — still actively used in pkg/cli/pr_helpers.go
Original prompt

This section details on the original issue you should resolve

<issue_title>[CI Failure Doctor] lint-go fails on unused git helper functions</issue_title>
<issue_description>### CI Failure Investigation - Run github/gh-aw#38482

Summary

The lint-go job in run 22569526195 failed because golangci-lint reported that three git helper functions in pkg/cli/git.go are unused. These helpers are no longer called anywhere in the codebase, so the lint failure is blocking the CI run.

Failure Details

Root Cause Analysis

golangci-lint flags pkg/cli/git.go because pullFromRemote, pushToRemote, and commitAndPushChanges are defined but never invoked. The lint job fails before any downstream checks can run, so the entire CI run is marked as failed even though the rest of the workflow succeeded.

Failed Jobs and Errors

  • lint-go: pkg/cli/git.go: pullFromRemote is unused (unused)
  • lint-go: pkg/cli/git.go: pushToRemote is unused (unused)
  • lint-go: pkg/cli/git.go: commitAndPushChanges is unused (unused)
Investigation Findings

golangci-lint run ./pkg/cli surfaces the unused-function errors, and those helpers are not referenced anywhere else in the repository. Removing the dead helpers restores lint health without changing user-visible behavior.

Recommended Actions

  • Remove the unused git helper functions (pullFromRemote, pushToRemote, commitAndPushChanges) from pkg/cli/git.go or reintroduce usage so golangci-lint stops flagging them.

Prevention Strategies

Keep golangci-lint's unused check as a gate and run it locally before pushing, especially when touching CLI helper files that frequently accumulate dead code.

AI Team Self-Improvement

Always run golangci-lint run ./pkg/cli after editing CLI helpers to catch unused exports early in the development cycle.

Historical Context

No recent CI Failure Doctor issues match this unused-function signature for the CLI git helpers.

🩺 Diagnosis provided by CI Failure Doctor

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/ci-doctor.md@ea350161ad5dcc9624cf510f134c6a9e39a6f94d
  • expires on Mar 3, 2026, 9:38 AM UTC

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI failure by removing unused git helper functions fix: remove unused git helper functions causing lint-go CI failure Mar 2, 2026
@pelikhan pelikhan marked this pull request as ready for review March 2, 2026 12:19
Copilot AI review requested due to automatic review settings March 2, 2026 12:19
Copy link
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

Removes dead git helper functions from pkg/cli/git.go to resolve golangci-lint failures from the unused analyzer without changing runtime behavior.

Changes:

  • Deleted unused helpers: pullFromRemote, pushToRemote, and commitAndPushChanges.
  • Deleted now-orphaned helpers: hasChangesToCommit and hasRemote.
  • Kept stageAllChanges (still used by PR creation helpers).

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

@pelikhan pelikhan merged commit 5551dc6 into main Mar 2, 2026
110 checks passed
@pelikhan pelikhan deleted the copilot/remove-unused-git-helper-functions branch March 2, 2026 12:24
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.

[CI Failure Doctor] lint-go fails on unused git helper functions

3 participants