support installation via Bzlmod or WORKSPACE in addition to go.mod#1
Merged
support installation via Bzlmod or WORKSPACE in addition to go.mod#1
Conversation
jamesma100
approved these changes
Jun 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While this repo was previously consumable as a go dependency (which is in fact how our internal monorepo consumes it), it is also useful to allow installation via Bzlmod or WORKSPACE for repos which otherwise don't require a go environment. Support for these is added here, although Bzlmod currently requires an
--override_moduleflag as we aren't published to the Bazel Central Registry.The two main bits of complexity here are:
Making sure the requisite go module dependencies get installed. Bzlmod handles this for us, but WORKSPACE requires that we set up Gazelle to generate a macro users can call to install them.
Solving the patching situation with go-tree-sitter. There is an unreleased fix merged to rules_go which this PR uses to remove the need for patching in this repo. However, we still require the patch being available for downstream users who might not have the rules_go fix available. In the WORKSPACE setup this is handled for them by the
scala_gazelle_depsmacro, but Bzlmod users will have to add thego_deps.module_overridemanually as it is only callable from their repo's root module.