jhump / protoreflect

Reflection (Rich Descriptors) for Go Protocol Buffers
Apache License 2.0
1.33k stars 170 forks source link

desc/protoparse: fix recently identified regressions from v1.14 #594

Closed jhump closed 7 months ago

jhump commented 7 months ago

Fixes #590 and #591.

When v1.15 was implemented, which replaces desc/protoparse with thin veneer on top of the github.com/bufbuild/protocompile module, a new constraint was inadvertently added, requiring that files explicitly named in parser.Parse had to be provided as source and could not be provided as descriptors. But this constraint was not present in v1.14.1 and thus a regression for any code that took advantage of the lack of that constraint.

Similarly, when the Parser.ParseFilesButDoNotLink method was re-implemented, it was incorrectly using Parser.ImportPaths, despite the Go docs for that field saying they are unused for the "do not link" operation.

This PR fixes both of these regressions, so more code that uses v1.14 can correctly be upgraded to use v1.15.