Skip to content

Commit c8b73fb

Browse files
authored
protoc-gen-go: generate descriptor before plugins (#718)
Avoid interleaving plugin output with the rest of the generated code. No functional change, but simplifies keeping the v1 and v2 generator output identical.
1 parent 7716a98 commit c8b73fb

File tree

3 files changed

+45
-46
lines changed

3 files changed

+45
-46
lines changed

protoc-gen-go/generator/generator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,12 +1137,11 @@ func (g *Generator) generate(file *FileDescriptor) {
11371137
g.generateExtension(ext)
11381138
}
11391139
g.generateInitFunction()
1140+
g.generateFileDescriptor(file)
11401141

11411142
// Run the plugins before the imports so we know which imports are necessary.
11421143
g.runPlugins(file)
11431144

1144-
g.generateFileDescriptor(file)
1145-
11461145
// Generate header and imports last, though they appear first in the output.
11471146
rem := g.Buffer
11481147
remAnno := g.annotations

protoc-gen-go/testdata/deprecated/deprecated.pb.go

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protoc-gen-go/testdata/grpc/grpc.pb.go

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)