fix(gazelle): Cease write narrow visibilities #1681
Closed
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.
This PR causes Gazelle to not write
visibility
lines for generated rules.Context
This is necessary in monorepo situations where there are multiple
# gazelle:python_root
directives used, e.g. in the structure below:As it stands, we write a narrowly scoped
visibility
attribute for every generated rule; the visibility is//{python-root-package}:__subpackages__
. Let's not!Alternatives
Two considered alternatives were:
# gazelle:default_visibility
directive. This is probably correct in the long run, but I'm not Go-literate.//visibility:public
. This achieves correct behavior but gives less control than the current PR. Instead of respecting any default visibility stanzas, it forces the entirety to be public.Preserving current behavior
If someone wants the current behavior, it can still be achieved by setting the following in Python root's BUILD file: