bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
8.93k stars 267 forks source link

Improve insertion point behaviour #3092

Closed emcfarlane closed 3 months ago

emcfarlane commented 3 months ago

Small improvements on creating insertion points. Removes the need to trim the resulting file for newlines. Removes a buffer allocation to build each insertion.

emcfarlane commented 3 months ago

Tests are here with some benchmarks that show the improvements. #3090 improved the coverage for the error cases captured in that issue. Agree that the benchmarks don't matter for this flow but thought this simplified it and removed the workarounds for both newline printing, that caused the original panic issue, and the need to calculate a buffer size.