Draft
Conversation
Contributor
Files inventory check summaryFile checks results against ancestor 960d881b: Results for datadog-agent_7.78.0~devel.git.362.20227cf.pipeline.100708395-1_amd64.deb:No change detected |
### What does this PR do? - add `bazel/tools/stringer_wrapper.sh` + `sh_binary`: wrapper that puts the rules_go `go` binary on PATH and cds to the package directory before invoking stringer, so the generated header matches `//go:generate` output exactly - add `bazel/rules/go_stringer.bzl`: `go_stringer` Starlark macro wrapping `run_binary`; params: `name`, `src`, `type`, `gomod`, `output`, `trimprefix`, `linecomment`, `go_tags`, `**kwargs` - add `internal/tools/gazelle-stringer/`: Gazelle language extension that reads `//go:generate stringer` directives and emits `go_stringer` rules; wired into a custom `gazelle_binary` at `//:gazelle` - Bazelify `pkg/template` as proof of concept: BUILD.bazel files for the root package, `internal/fmtsort`, `text`, and `html`; the six `html` stringer targets, one `write_source_file` diff-test per target, and `go_library` targets; unexclude `pkg/template` from the root Gazelle exclusion list - update checked-in `*_string.go` files in `pkg/template/html`; those files were copied from the Go stdlib in #36024 and had never been regenerated in this repo; the diffs reflect a newer `golang.org/x/tools` version bundled with rules_go vs what the Go team used at the time ### Motivation Replaces manual `go generate` invocations with hermetic Bazel actions, making the build self-contained and stringer outputs verifiable via `bazel test`. ### Describe how you validated your changes - `bazel build //pkg/template/html:...` builds all six stringer targets and the `go_library` - `bazel test //pkg/template/...` passes six diff-tests (one per generated file) - `bazel run //:gazelle -- -mode=diff` produces no diff
6bfdae0 to
20227cf
Compare
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.
What does this PR do?
Motivation
Describe how you validated your changes
Additional Notes