bazel-gazelle
bazel-gazelle copied to clipboard
Support patch then auto generate build file
What version of gazelle are you using?
0.23.0
What version of rules_go are you using?
1.16.3
What version of Bazel are you using?
4.1.0
Does this issue reproduce with the latest releases of all the above?
yes
What operating system and processor architecture are you using?
ubuntu and x86_64
What did you do?
I want to patch a golang module that removes a third party module from its dependencies. However, after I patch the module, the module is still added as an target dependency for the module that I patched
What did you expect to see?
I expect to see that the build file generated for the patched module to not have the removed third party dependency.
What did you see instead?
I see the third party dependency as a dependency of the patched module. I expect that the module is patched first and then the build file is generated
From https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.rst#go_repository
patches A list of patches to apply to the repository after gazelle runs.
I think the documentation is clear and correct. If you're interested in putting up a PR adding this functionality, perhaps via something like pre_patches
, then that might be useful enough without being too confusing.. although there are already 4 patch-related attributes, and I'd hope that patching pre-gazelle does not have to double those.
If you're not interested in working on this, then I'd like to close this as "working as intended". There's obviously very little development bandwidth, and this would not make the cut. Thanks
We added this a while ago as a patch for our internal use. The patch is at https://github.com/monogon-dev/monogon/blob/main/third_party/gazelle/add-prepatching.patch. If people are interested we could PR it.