easyjson icon indicating copy to clipboard operation
easyjson copied to clipboard

Is there a way to only generate Unmarshalers

Open jcapobianco1 opened this issue 4 years ago • 1 comments

We have a use case where we are using easyjson to unmarshal json directly into the structs created by protobuf's protoc.

It has been working really well until the recent update to protobuf, which introduced mutexes to the types. This means that the go compiler complains because we try to pass a type by reference, therefore copying a mutex, in the encoding functions. However, the decoding functions are fine because they use pointers.

Lucky for us, we can live without marshaling. Is there a way to tell easyjson to only create the unmarshal/decoding functions and not the marshal/encoding functions?

jcapobianco1 avatar Dec 03 '20 22:12 jcapobianco1

I couldn't find the ability to do it in the codebase so I made a fork. Here is the PR with relevant changes https://github.com/jcapobianco-cbi/easyjson/pull/1/files. If this is something the maintainers are interested in I could submit a PR to the mailru repo

jcapobianco1 avatar Dec 04 '20 16:12 jcapobianco1