You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tools: keep protobuf generation reproducible and generated files in sync #1527
Describe the feature you'd like and the problem it will solve
Running ./tools/gen_pb_go.sh from a clean checkout of main modifies 25 generated .pb.go files. When regenerating Starlark protobufs, 24 of those changes are unrelated files and appear to be comment-indentation changes, creating noisy diffs for feature PRs.
I verified the output is deterministic across repeated runs. The committed and regenerated file headers also report the same versions (protoc-gen-go v1.36.12 and protoc v6.33.5), so the version difference between the generator and go.mod's protobuf runtime dependency (v1.36.11) does not explain this indentation drift.
For example, probes/ping/proto/config.proto contains this comment:
// sudo sysctl -w net.ipv4.ping_group_range="0 <large valid group id>"
The committed probes/ping/proto/config.pb.go renders it with a tab after //, while a fresh generation preserves the spaces from the .proto source. This suggests some checked-in generated files are stale relative to their source comments.
The generation script also installs protoc-gen-go and protoc-gen-go-grpc using @latest, so the plugin versions can change over time without a repository change.
Please consider:
Bringing checked-in generated protobuf files into sync with their current .proto sources, so a clean regeneration does not produce unrelated comment-only diffs.
Pinning the protobuf compiler and Go generator plugin versions used by tools/gen_pb_go.sh so future output is reproducible.
Thanks for the detailed report. I could reproduce the diff, but the cause is different from what the issue suggests: the checked-in files aren't stale.
With protoc 33.5 and protoc-gen-go v1.36.12, the output depends on the Go version used to build the plugin:
Go version building protoc-gen-go
.pb.go files changed on main
1.23, 1.24, 1.25, 1.26.6
0
1.27.0
26
The 1.27 diff is comment-only and matches what you describe, including the ping_group_range example. I'm guessing you're on Go 1.27. go install ...@latest builds the plugin with the locally installed Go rather than the version in go.mod (currently 1.26.6), so that was the unpinned variable. The plugin versions themselves happened to match.
Thanks Manu - you're completely right, I'm on go version go1.27.1 darwin/arm64.
I've only included the relevant changes in #1513 rather than the changes made to ALL.pb.go files - take a look and lemme know if that's ok, or if you also want me to make changes to probes/starlark/proto/config.proto.
Activity
manugarg commentedon Oct 5, 2026
Thanks for the detailed report. I could reproduce the diff, but the cause is different from what the issue suggests: the checked-in files aren't stale.
With protoc 33.5 and
protoc-gen-gov1.36.12, the output depends on the Go version used to build the plugin:protoc-gen-go.pb.gofiles changed onmainThe 1.27 diff is comment-only and matches what you describe, including the
ping_group_rangeexample. I'm guessing you're on Go 1.27.go install ...@latestbuilds the plugin with the locally installed Go rather than the version ingo.mod(currently 1.26.6), so that was the unpinned variable. The plugin versions themselves happened to match.#1528 fixes this in
tools/gen_pb_go.shby:protoc-gen-goandprotoc-gen-go-grpcversions, as you suggested, andgo.mod(viaGOTOOLCHAIN), so the output is the same regardless of the local Go install.We'll regenerate everything in one commit when
go.modmoves to Go 1.27, rather than now, as doing it now would move the noise to everyone on 1.26.For #1513: please drop the unrelated
.pb.gochanges. Once #1528 is in, rebasing and re-running the script should touch only the starlark proto.aholden85 commentedon Oct 5, 2026
Thanks Manu - you're completely right, I'm on
go version go1.27.1 darwin/arm64.I've only included the relevant changes in #1513 rather than the changes made to ALL
.pb.gofiles - take a look and lemme know if that's ok, or if you also want me to make changes toprobes/starlark/proto/config.proto.[tools] Pin protoc plugins and the Go version they're built with (#1528)