-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Describe the bug
The core update checking logic has not reported updates to users since v2.59.0 release because the updaterEnabled package variable was relocated. This package variable is set in our Homebrew formula, however the main import path no longer applies, requiring setting the new, fully qualified Go package instead:
with_env(
"GH_VERSION" => gh_version,
"GO_LDFLAGS" => "-s -w -X main.updaterEnabled=cli/cli",
) do
system "make", "bin/gh", "manpages"
end
bin.install "bin/gh"whereas now this would be:
with_env(
"GH_VERSION" => gh_version,
"GO_LDFLAGS" => "-s -w -X github.com/cli/cli/v2/internal/ghcmd.updaterEnabled=cli/cli",
) do
system "make", "bin/gh", "manpages"
end
bin.install "bin/gh"The main package appears to be special from what I can gather in the depths of Go cmd/link source code, however this behavior isn't well documented.
Relates #9745
Steps to reproduce the behavior
-
Clone Homebrew formula repository
gh repo clone homebrew/homebrew-core
-
Install
2.58.0version via Homebrewbrew remove gh git -C homebrew-core checkout 06ce7bd256e44f9382de1b02e2a12662be994d61 brew install ./homebrew-core/Formula/g/gh.rb gh version
confirming:
gh version 2.58.0 (2024-10-01) https://github.com/cli/cli/releases/tag/v2.58.0 -
Clean up older state file and run
ghcommand to generate update noticerm ~/.local/state/gh/state.yml gh pr list --state all --limit 1000 --repo cli/cliconfirming:
A new release of gh is available: 2.58.0 → 2.65.0 To upgrade, run: brew upgrade gh https://github.com/cli/cli/releases/tag/v2.65.0 -
Install
2.59.0version via Homebrewbrew remove gh git -C homebrew-core checkout 628e97421ed16b9502409891c38175167c066b6a brew install ./homebrew-core/Formula/g/gh.rb gh version
confirming:
gh version 2.59.0 (2024-10-15) https://github.com/cli/cli/releases/tag/v2.59.0 -
Clean up older state file and run
ghcommand but no update noticerm ~/.local/state/gh/state.yml gh pr list --state all --limit 1000 --repo cli/cli
Expected vs actual behavior
brew based builds should notify the user on stderr if a new release is present.
Logs
Paste the activity from your command line. Redact if needed.