jmattheis / goverter

Generate type-safe Go converters by simply defining an interface
https://goverter.jmattheis.de/
MIT License
496 stars 46 forks source link

Improve value return on err #19

Closed jmattheis closed 1 year ago

jmattheis commented 2 years ago

With #18 a compile error was fixed, but not in the most optimal way, because it produces an unnecessary allocation in the error case.

https://github.com/jmattheis/goverter/blob/5dba9cdc1fa7571c261721ad5a95649657883f27/scenario/3_struct_extend_pattern.yml#L45-L55

Currently, goverter doesn't know if there is already a variable existing with the right type, maybe there is a smart way to do this?