Open peterfajdiga opened 3 years ago
use gogo protobuf.
@FJSDS Thanks for the suggestion, but gogo protobuf is not always a suitable alternative. It does not, for example, support optional fields in proto3.
+1.
It should hopefully marshal to the same as https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson.
Easyjson does not work with structs generated by the Protocol Buffers go generator (protoc-gen-go).
The problem is that easyjson generates the
MarshalEasyJSON
method with a by-value receiver (introduced in https://github.com/mailru/easyjson/pull/15), but structs generated by protoc-gen-go shouldn't be copied.Using a by-reference receiver should solve this issue.