Repository navigation
Catch more file patterns - #1463
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request unifies the identification of Starlark files by updating patterns in the bash runner and the Go utility. The changes simplify extension matching and add support for WORKSPACE.bzlmod. A review comment points out inconsistencies between the two implementations, specifically missing patterns in the bash template for *.star, WORKSPACE.bzlmod, and BUILD.oss.
Previously `buildifier -r .` would not pick up `foo.BUILD.bazel` files or `foo.BUILD` files even though the `runner.bash.template` would. This attempts to unify these.
keith
force-pushed
the
ks/catch-more-file-patterns
branch
from
April 14, 2026 20:53
3eae3b4 to
4a9d78a
Compare
Member
Author
|
@vladmos ptal |
rdesgroppes
added a commit
to DataDog/datadog-agent
that referenced
this pull request
Sep 29, 2026
### What does this PR do? Bump the pinned Bazel `buildtools` binaries (`buildifier`, `buildozer` and `unused-deps`) from `v8.2.1` (former `bazelbuild/buildtools`) to `v10.1.0` (now `bazel-contrib/buildtools`) in: - `bazel/prebuilt_buildtools.json`, - the corresponding `http_archive` in `MODULE.bazel` (invocation helpers). Add a `go_shim` target to `buildozer` so the bumped binary is directly runnable via `bazel run //:buildozer -- ...`. Regenerate `bazel/patches/buildifier-runner-bat-template.patch` against `v10.1.0`, which allows us to drop a patch whose purpose is now subsumed by upstream's own generalized `*.bazel` glob in `runner.bash.template` (bazel-contrib/buildtools#1463). Apply `bazel run //bazel/buildifier`'s resulting formatting fixes across matched files. ### Motivation Bazel `buildtools` were pinned to `v8.2.1`, well behind upstream, so newer `buildozer` capabilities were unavailable, which surfaced while working on #56440: an `invoke` task needs to update a dict-of-lists attribute via `buildozer` (`msgo` SDK bump for [ABLD-525]). At `v8.2.1`, `buildozer`'s dict-editing commands are unsafe for that shape: `dict_set` only accepts a scalar value, and `dict_list_add` silently sorts the list it builds, which would swap `filename` and `sha256` whereas `rules_go` unpacks that pair **positionally**. The fix, a `set attr:expr <literal>` command, landed in bazel-contrib/buildtools#1448 for `v10.0.1`, requiring the pin to move past it. ### Describe how you validated your changes `bazel run //bazel/buildifier` works on both Linux **and Windows**. ### Additional Notes `module-docstring` is suppressed in `.buildifier.json` for unrelated, pre-existing reasons predating this PR. [ABLD-525]: https://datadoghq.atlassian.net/browse/ABLD-525?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
rdesgroppes
added a commit
to DataDog/datadog-agent
that referenced
this pull request
Sep 29, 2026
### What does this PR do? Bump the pinned Bazel `buildtools` binaries (`buildifier`, `buildozer` and `unused-deps`) from `v8.2.1` (former `bazelbuild/buildtools`) to `v10.1.0` (now `bazel-contrib/buildtools`) in: - `bazel/prebuilt_buildtools.json`, - the corresponding `http_archive` in `MODULE.bazel` (invocation helpers). Add a `go_shim` target to `buildozer` so the bumped binary is directly runnable via `bazel run //:buildozer -- ...`. Regenerate `bazel/patches/buildifier-runner-bat-template.patch` against `v10.1.0`, which allows us to drop a patch whose purpose is now subsumed by upstream's own generalized `*.bazel` glob in `runner.bash.template` (bazel-contrib/buildtools#1463). Apply `bazel run //bazel/buildifier`'s resulting formatting fixes across matched files. ### Motivation Bazel `buildtools` were pinned to `v8.2.1`, well behind upstream, so newer `buildozer` capabilities were unavailable, which surfaced while working on #56440: an `invoke` task needs to update a dict-of-lists attribute via `buildozer` (`msgo` SDK bump for [ABLD-525]). At `v8.2.1`, `buildozer`'s dict-editing commands are unsafe for that shape: `dict_set` only accepts a scalar value, and `dict_list_add` silently sorts the list it builds, which would swap `filename` and `sha256` whereas `rules_go` unpacks that pair **positionally**. The fix, a `set attr:expr <literal>` command, landed in bazel-contrib/buildtools#1448 for `v10.0.1`, requiring the pin to move past it. ### Describe how you validated your changes `bazel run //bazel/buildifier` works on both Linux **and Windows**. ### Additional Notes `module-docstring` is suppressed in `.buildifier.json` for unrelated, pre-existing reasons predating this PR. [ABLD-525]: https://datadoghq.atlassian.net/browse/ABLD-525?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
rdesgroppes
added a commit
to DataDog/datadog-agent
that referenced
this pull request
Sep 29, 2026
### What does this PR do? Bump the pinned Bazel `buildtools` binaries (`buildifier`, `buildozer` and `unused-deps`) from `v8.2.1` (former `bazelbuild/buildtools`) to `v10.1.0` (now `bazel-contrib/buildtools`) in: - `bazel/prebuilt_buildtools.json`, - the corresponding `http_archive` in `MODULE.bazel` (invocation helpers). Add a `go_shim` target to `buildozer` so the bumped binary is directly runnable via `bazel run //:buildozer -- ...`. Regenerate `bazel/patches/buildifier-runner-bat-template.patch` against `v10.1.0`, which allows us to drop a patch whose purpose is now subsumed by upstream's own generalized `*.bazel` glob in `runner.bash.template` (bazel-contrib/buildtools#1463). Apply `bazel run //bazel/buildifier`'s resulting formatting fixes across matched files. ### Motivation Bazel `buildtools` were pinned to `v8.2.1`, well behind upstream, so newer `buildozer` capabilities were unavailable, which surfaced while working on #56440: an `invoke` task needs to update a dict-of-lists attribute via `buildozer` (`msgo` SDK bump for [ABLD-525]). At `v8.2.1`, `buildozer`'s dict-editing commands are unsafe for that shape: `dict_set` only accepts a scalar value, and `dict_list_add` silently sorts the list it builds, which would swap `filename` and `sha256` whereas `rules_go` unpacks that pair **positionally**. The fix, a `set attr:expr <literal>` command, landed in bazel-contrib/buildtools#1448 for `v10.0.1`, requiring the pin to move past it. ### Describe how you validated your changes `bazel run //bazel/buildifier` works on both Linux **and Windows**. ### Additional Notes `module-docstring` is suppressed in `.buildifier.json` for unrelated, pre-existing reasons predating this PR. [ABLD-525]: https://datadoghq.atlassian.net/browse/ABLD-525?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Sep 29, 2026
…57078) ### What does this PR do? Bump the pinned Bazel `buildtools` binaries (`buildifier`, `buildozer` and `unused-deps`) from `v8.2.1` (former `bazelbuild/buildtools`) to `v10.1.0` (now `bazel-contrib/buildtools`) in: - `bazel/prebuilt_buildtools.json`, - the corresponding `http_archive` in `MODULE.bazel` (invocation helpers). Add a `go_shim` target to `buildozer` so the bumped binary is directly runnable via `bazel run //:buildozer -- ...`. Regenerate `bazel/patches/buildifier-runner-bat-template.patch` against `v10.1.0`, which allows us to drop a patch whose purpose is now subsumed by upstream's own generalized `*.bazel` glob in `runner.bash.template` (bazel-contrib/buildtools#1463). ### Motivation Bazel `buildtools` were pinned to `v8.2.1`, well behind upstream, so newer `buildozer` capabilities were unavailable, which surfaced while working on #56440: an `invoke` task needs to update a dict-of-lists attribute via `buildozer` (`msgo` SDK bump for [ABLD-525]). At `v8.2.1`, `buildozer`'s dict-editing commands are unsafe for that shape: `dict_set` only accepts a scalar value, and `dict_list_add` silently sorts the list it builds, which would swap `filename` and `sha256` whereas `rules_go` unpacks that pair **positionally**. The fix, a `set attr:expr <literal>` command, landed in bazel-contrib/buildtools#1448 for `v10.0.1`, requiring the pin to move past it. ### Describe how you validated your changes `bazel run //bazel/buildifier` works on both Linux **and Windows**. ### Additional Notes This change was too large, leading to the extraction of following prerequisites: - #57087 - #57088 - #57090 [ABLD-525]: https://datadoghq.atlassian.net/browse/ABLD-525?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: regis.desgroppes <[email protected]>
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.
Previously
buildifier -r .would not pick upfoo.BUILD.bazelfilesor
foo.BUILDfiles even though therunner.bash.templatewould. Thisattempts to unify these.