Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #400 +/- ##
==========================================
+ Coverage 73.35% 73.38% +0.03%
==========================================
Files 88 88
Lines 11284 11300 +16
==========================================
+ Hits 8277 8293 +16
Misses 2440 2440
Partials 567 567 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
wenchy
approved these changes
Apr 22, 2026
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.
Summary
When generating
.protofiles viabookExporter.export, language-specificfeature options (e.g.
features.(pb.go).*,features.(pb.cpp).*,features.(pb.java).*) used to require callers to also manually declare thematching
*_features.protoimports, and the emittedoptionlines came outin Go's non-deterministic map iteration order.
This MR fixes both issues.
Changes
internal/protogen/exporter.goProtoFileOptions. While building the importset, scan each option key and add the corresponding well-known proto:
features.(pb.go)→google/protobuf/go_features.protofeatures.(pb.cpp)→google/protobuf/cpp_features.protofeatures.(pb.java)→google/protobuf/java_features.protoBecause imports are kept in a
treesetkeyed by path, duplicates arenaturally deduplicated and output stays sorted by import path.
optionlines in alphabetical order of the key instead of relyingon Go's randomized map iteration, producing stable, diff-friendly output.
internal/protogen/exporter_test.goTest_bookExporter_exportcovering:proto3baseline output.edition = "2023"withfeatures.utf8_validation.edition = "2024"withfeatures.strip_enum_prefix.pb.go/pb.cpp/pb.javain isolation,asserting that only the matching
*_features.protois imported.added and options appear in the file.
non-alphabetical order in the input map.
go_features.proto/cpp_features.proto/java_features.proto(api_level,string_type,utf8_validation,legacy_closed_enum, ...) rather than synthetic names..github/workflows/*.yml(lint / testing / release / publish-module-to-bsr)Actions" extension on save (e.g.
[master, main]→[ master, main ],minor spacing normalizations). No workflow semantics are changed.
Compatibility
bookExporteris unchanged.*_features.protomanually, the import setdeduplicates via
treeset, so no duplicate import lines are produced.byte-for-byte comparisons of previously generated files but not their
semantics.