Skip to content

Remove stale goenv shims from v2 installations during upgrade to v3#537

Merged
ChronosMasterOfAllTime merged 4 commits into
mainfrom
handle-old-shims
May 19, 2026
Merged

Remove stale goenv shims from v2 installations during upgrade to v3#537
ChronosMasterOfAllTime merged 4 commits into
mainfrom
handle-old-shims

Conversation

@AdamDrewsTR

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds logic to detect and remove a stale goenv shim left behind by v2 installations during upgrades to v3. The stale shim (a bash wrapper that hard-codes a Homebrew Cellar libexec/goenv path baked in at rehash time) shadows the new v3 binary on PATH, so the cleanup is wired into the four entry points users may take to install/upgrade. The PowerShell installer is also rewritten with Join-Path, a more robust Write-ColorOutput, TLS 1.2, and an auto-profile setup step.

Changes:

  • Detect v2 shim by content match on libexec/goenv and remove it from install.sh, install.ps1, scripts/swap/main.go, and cmd/root.go (PersistentPreRun).
  • Refactor install.ps1 to use Join-Path, force TLS 1.2, switch to Write-Host-based color output, and add Initialize-PowerShellProfile.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
install.sh Adds post-install removal of v2 shim using grep fingerprint check.
install.ps1 Adds shim cleanup, TLS 1.2 enforcement, Join-Path-based path building, refactored color output, and PowerShell profile auto-config.
scripts/swap/main.go Removes stale v2 shim after swapping the goenv binary, falling back to ~/.goenv when GOENV_ROOT is unset.
cmd/root.go In PersistentPreRun, silently removes a stale v2 goenv shim if found in the shims directory.

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

Comment thread install.ps1 Outdated
Comment thread install.ps1 Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread cmd/root.go Outdated
Comment thread scripts/swap/main.go
Comment thread install.ps1 Outdated
@ChronosMasterOfAllTime ChronosMasterOfAllTime added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 6de0c92 May 19, 2026
11 checks passed
@ChronosMasterOfAllTime ChronosMasterOfAllTime deleted the handle-old-shims branch May 19, 2026 15:12
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