Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 2, 2025

  • Create go_dumper.rb to dump installed Go packages
  • Create go_installer.rb to install Go packages
  • Create go_checker.rb to check if Go packages are installed
  • Update dsl.rb to add go method
  • Update installer.rb to handle :go entry type
  • Update lister.rb to support listing Go packages
  • Update remover.rb to support removing Go entries (inherited from base remover)
  • Update checker.rb to support checking Go packages
  • Update dumper.rb to include Go packages in dump
  • Update bundle.rb to add go_installed? helper method
  • Update cmd/bundle.rb to add --go flag support
  • Create tests for go_dumper.rb
  • Create tests for go_installer.rb
  • Update tests for dsl.rb to include Go example
  • Update documentation
  • Fix go_dumper parsing and add RBI type definitions
  • Rename parameter from packages: to go:
  • Rename packages_to_install to go_packages_to_install
  • Add Sorbet signature to go method
  • Fix typecheck errors
  • All manual tests pass

Fixes #20645

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for installing go packages in Brewfile</issue_title>
<issue_description>### Verification

Provide a detailed description of the proposed feature

Add support for installing go packages in Brewfile. Include the ability to specify go packages in the Brewfile.

For example:

brew "tree"
brew "node"
go "github.com/charmbracelet/crush"

The Brewfile already supports a variety of installation types, with mas, cask, vscode.

Tooling written in Go is so often available via go install <package>@latest commands. It'd be convenient if the Brewfile bundled and ensures go applications were installed too.

What is the motivation for the feature?

To expand the convenience of Brewfile so that it manages the bundling / setting up of more applications.

How will the feature be relevant to at least 90% of Homebrew users?

Go is a common language for so much tooling.

What alternatives to the feature have been considered?

Not do this. Manage the installation of go tools manually or via some other means.</issue_description>

<agent_instructions>Implement this similarly to other types.</agent_instructions>

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

@MikeMcQuaid Are all these criteria met?

https://docs.brew.sh/Brew-Bundle-and-Brewfile#adding-new-packages-support

@MikeMcQuaid @leighmcculloch Thanks! More questions:

👍🏻 Go binaries are installed to the local GOBIN directory. The GOBIN directory can be discovered by running go env GOBIN. Looking for the respective binary there requires a) searching for a binary with the matching name b) running go version -m -json <binary-name> and looking at the output to determine whether it matches the full path the user wishes to check is installed.

Does this refer to a unique name that can be used to reference the software? If so, then 👍🏻. Each Go package that gets installed has a unique path. For example: github.com/charmbracelet/crush.

This question is: how is a binary name mapped to/from a go install <package> invocation? Does <package> always == "binary name"?

Also: would it be desired/expected that brew bundle dump would dump all previous go install binaries and brew bundle cleanup would uninstall (how?) all un-dumped go install binaries?

@MikeMcQuaid @leighmcculloch Thanks! One more: is there a `go uninstall` for removal?
Fixes #20645

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@MikeMcQuaid
Copy link
Member

@copilot try again

Copy link
Contributor Author

Copilot AI commented Oct 2, 2025

@copilot try again

Fixed! The issues were:

  1. Go dumper parsing: Fixed the go version -m output parsing to correctly extract the package path from tab-separated format (commit ab0f4dc)
  2. Sorbet type checking: Added the missing go? method to the bundle.rbi file for proper type definitions (commit ab0f4dc)

All manual tests now pass successfully:

  • ✓ Dump Go packages
  • ✓ Check installed packages
  • ✓ List Go packages

The implementation follows the same pattern as other package types (vscode, whalebrew) and meets all the criteria from the documentation.

Copilot finished work on behalf of MikeMcQuaid October 2, 2025 18:52
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

@copilot use go: instead of packages:

Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot use go: instead of packages:

Done! Changed all occurrences of packages: to go: throughout the codebase (commit 36d9a9d).

Updated files:

  • Library/Homebrew/bundle/lister.rb
  • Library/Homebrew/bundle/dumper.rb
  • Library/Homebrew/bundle/commands/dump.rb
  • Library/Homebrew/bundle/commands/list.rb
  • Library/Homebrew/cmd/bundle.rb

The parameter naming is now consistent with the --go flag and go "package" DSL syntax.

Copilot AI requested a review from MikeMcQuaid October 3, 2025 15:42
Copilot finished work on behalf of MikeMcQuaid October 3, 2025 15:42
Copilot AI requested a review from MikeMcQuaid October 6, 2025 16:25
Copilot finished work on behalf of MikeMcQuaid October 6, 2025 16:25
@MikeMcQuaid MikeMcQuaid changed the title [WIP] Add support for installing go packages in Brewfile Add support for installing go packages in Brewfile Oct 7, 2025
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review October 7, 2025 16:13
@MikeMcQuaid MikeMcQuaid force-pushed the copilot/fix-873fd7ad-dbea-4bae-8dbe-bfd4bc9e7883 branch from b81250d to b01f92b Compare October 8, 2025 08:00
@MikeMcQuaid
Copy link
Member

@copilot run brew typecheck and fix errors

Copy link
Contributor Author

Copilot AI commented Oct 8, 2025

@copilot run brew typecheck and fix errors

Fixed! The typecheck errors were:

  1. Unreachable code in dsl.rb: Removed redundant runtime type check since the Sorbet signature sig { params(name: String).void } already enforces the type at compile time
  2. Test file typing level: Changed go_dumper_spec.rb from typed: strict to typed: true to avoid false positives from RSpec DSL

Changes committed and functionality verified.

Copilot finished work on behalf of MikeMcQuaid October 8, 2025 08:18
@MikeMcQuaid MikeMcQuaid force-pushed the copilot/fix-873fd7ad-dbea-4bae-8dbe-bfd4bc9e7883 branch from b12a8d1 to 73f82a5 Compare October 9, 2025 15:37
@MikeMcQuaid MikeMcQuaid enabled auto-merge October 9, 2025 15:54
@MikeMcQuaid MikeMcQuaid force-pushed the copilot/fix-873fd7ad-dbea-4bae-8dbe-bfd4bc9e7883 branch from 73f82a5 to 4be4225 Compare October 10, 2025 15:56
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 7a6ddfe Oct 10, 2025
40 checks passed
@MikeMcQuaid MikeMcQuaid deleted the copilot/fix-873fd7ad-dbea-4bae-8dbe-bfd4bc9e7883 branch October 10, 2025 16:45
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.

Add support for installing go packages in Brewfile

3 participants