protoc: stream generated file copies (#4647)
go-protoc stages plugin output in a temporary directory and then copies
each generated Go file to its declared output path. This matters because
large generated protobuf files can make the old ioutil.ReadFile plus
WriteFile path allocate a full byte slice for each output before writing
it.
Copy generated files with io.Copy instead. This keeps the same output
paths, truncation behavior, and file mode, while bounding memory use to
the copy buffer instead of the generated file size.
1 file changed