Repository navigation
fix: 32-bit build, strict resolvers, Result.Files errors, Editions 2023 features, and stable protobuf - #1
Merged
Conversation
Cast len(src) to uint64 before comparing with math.MaxUint32 so the lexer compiles on 32-bit targets (such as linux/arm7), and add a linux/arm7 cross-build check to CI.
…d errors Do not append DirResolver or fall back to os.Stat/os.ReadFile when a custom Resolver is configured via WithResolver. Propagate non-ErrFileNotFound resolver errors (such as context cancellation or sandbox/I/O failures) out of Compile and import traversal without swallowing them.
Change (*Result).Files to return ([]protoreflect.FileDescriptor, error) instead of silently returning nil when proto.Unmarshal or protodesc.NewFiles fails. When compiled files declare extensions, re-unmarshal wireBytes with a dynamicpb extension resolver so option extensions are typed in protoreflect. Also avoid re-locking r.mu inside CodeGeneratorRequest.
… extensions Support parenthesized extension segments after '.' in field option and aggregate field names (e.g. features.(pb.cpp).string_type), evaluate and serialize FeatureSet options across all descriptor option targets with a built-in FeatureSet schema fallback, handle EDITION_UNSTABLE/EDITION_MAX in wire serialization, and add integration readiness tests.
Replace the pre-release google.golang.org/protobuf v1.37.0-rc.1 dependency with stable v1.36.12 in the root module and bench module.
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
Addresses five readiness issues for embedding
easyprotocas a Go library:lexer/lexer.go,.github/workflows/ci.yml):len(src)touint64before comparing againstmath.MaxUint32so 32-bit targets (e.g.,linux/arm7) compile cleanly.GOOS=linux GOARCH=arm GOARM=7 go build ./...to the CI build step.protoc/compile.go,protoc/resolver.go,internal/compiler/driver.go):DirResolverappending andos.Stat/os.ReadFilefallbacks whenever a customResolveris provided viaWithResolver.compiler.ErrFileNotFound/FileNotFoundError(aliased byprotoc.ErrFileNotFound) so non-not-found resolver errors (such ascontext.Canceled, permission errors, or sandbox rejections) propagate intact throughCompileand import traversal without being masked asFile not found.orErrCompilationFailed.Result.Files()error handling, option extension resolution, and deadlock fix (protoc/result.go,protoc/protoc_test.go):(*Result).Files()to return([]protoreflect.FileDescriptor, error)instead of silently returningnilonproto.Unmarshalorprotodesc.NewFilesfailures.dynamicpbextension resolver so option extensions (including feature extensions likepb.cpp) are exposed as typed fields viaprotoreflect(zero overhead fast path when no extensions are present).CodeGeneratorRequestviadescriptorSetLocked().features.*andfeatures.(ext).*(parser/parser.go,internal/options/features.go,internal/options/evaluator.go,internal/serialize/wire.go):.in field option names and aggregate fields (e.g.,[features.(pb.cpp).string_type = VIEW]).featuresacross all 9 descriptor*Optionstypes, with a built-ingoogle.protobuf.FeatureSetschema fallback so edition files work even without importinggoogle/protobuf/descriptor.proto.EDITION_UNSTABLEandEDITION_MAXtoresolveEditionin wire serialization.protoc/integration_readiness_test.go.google.golang.org/protobufdependency (go.mod,bench/go.mod):google.golang.org/protobuf v1.37.0-rc.1with stablev1.36.12in both the root andbenchmodules.Verification
test -z "$(gofmt -l .)"go vet ./...and(cd bench && go vet ./...)golangci-lint run ./...and(cd bench && golangci-lint run --config ../.golangci.yml ./...)(0 issues)GOOS=linux GOARCH=arm GOARM=7 go build ./...andgo test -cacross all packagesgo test -race -count=1 ./...bench/run.sh parity(wkt,compute,api-common,googleapis: all matchprotoc)