Description
As outlined in #447, TinyGo should support common serialization formats. While most people may think of JSON, I personally want TinyGo to support protocol buffers. This issue is meant to track my progress on adding Protocol Buffer support to TinyGo.
Design
The default Protocol Buffer package (https://pkg.go.dev/google.golang.org/protobuf) makes heavy use of reflection. TinyGo only supports a small amount of the reflect
package. Heavy use of reflection leads to slow code, so the folks at PlanetScale wrote vtprotobuf, which generates explicit serialization / deserialization code. This code works today with TinyGo. However, it requires the existing, slow code to compile.
So the plan is simple: Support compiling the code generated by protoc-gen-go and running and of the code contained in init()
functions. Use the code generated by vtprotobuf to serialize and deserialize the data.
Roadmap
- Compile code generated by https://github.com/planetscale/vtprotobuf
- Compile code generated by protoc-gen-go
- Import code generated by protoc-gen-go