Repository navigation
feat: full proto2 support and protoc 36.2 descriptor parity - #5
Merged
Merged
Conversation
…ons, and defer resolution to linker
…mantic validation
… float defaults, json_name, feature_support, and NaN options
ZergsLaw
force-pushed
the
feat/proto2-support
branch
from
December 3, 2026 20:40
1d07144 to
59e518a
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.
Summary
Brings
proto2compilation, validation, custom option wire encoding, andSourceCodeInfogeneration to full parity withprotoc 36.2:internal/linker/,internal/options/):fieldEncodingcomputation intoResolveFileafter cross-file type resolution so imported enum fields (including leading-dot references like.pkg.Enum) andLSPSession.DidChangeincremental re-links compute presence and packing accurately.parser/):proto2groupdeclarations insidemessage,extend(top-level and nested), andoneof, enforcing capitalized group names and[options]placement before{.optional/required/repeatedfield labels inproto2messages andextendblocks, and rejects labels insideoneof.[type.googleapis.com/pkg.Msg]) and colon-less list fields in aggregate option values, preserves rawdefaultliteral spans/kinds, matchesprotocsyntheticproto3 optionaloneof naming for leading underscores (_foo->X_foo), and defers all symbol resolution to the linker.internal/linker/):TYPE_GROUPfields and extensions to canonical.pkg.Scope.GroupNamewhile preservingTYPE_GROUPand group lookup aliases.option message_set_wire_format = trueandextensions ... to max(2147483647).default = ...values (disallowed on repeated/message/group, integer/uint bounds, bools, enum value membership), duplicate enum numbers withoutoption allow_alias = true,[packed = true]on non-repeated or non-packable types, invalidmap<K, V>key types,proto3customjson_namecollisions, andMessageSetconstraints.SourceCodeInfo(internal/options/,internal/serialize/,internal/sourceinfo/):TYPE_GROUP(StartGroup/EndGroup),MessageSetItemgroups, expandedgoogle.protobuf.Anyoption literals, and canonical IEEE-754 quietNaNfornan/-nan.FieldDescriptorProto.json_nameeven when empty (__or[json_name = ""]), formatsTYPE_FLOATnumeric defaults with 32-bit precision, and serializesEnumValueOptions.feature_support.protoc-identicalSourceCodeInfopaths and spans for group fields/synthetic messages (includingextend), nested extension option paths.(ext), andFeatureSetfields (features.*).proto2parity corpus (protoc/,bench/):protoc/proto2_parity_test.goandprotoc/proto2_errors_test.go.protocolbuffers/protobufatv36.2(2c74169) via sparse-checkout inbench/run.sh, adds the 14-fileproto2corpus tobench/run.sh parity, buildsfdsdiffwith-tags protolegacy, and guardsfdsdiffagainst typed-nil extension resolvers.Verification
test -z "$(gofmt -l .)"go vet ./...and(cd bench && go vet ./...)golangci-lint runand(cd bench && golangci-lint run --config ../.golangci.yml)(0 issues)GOOS=linux GOARCH=arm GOARM=7 go build ./...and(cd bench && go build ./...)go test -race -count=1 ./...bench/run.sh parity(wkt,proto2,compute,api-common,googleapis: allsame as protoc)