jmattheis / goverter

Generate type-safe Go converters by defining signatures of different types.
https://goverter.jmattheis.de/
MIT License
546 stars 48 forks source link

Distinguish empty map types #126

Closed yxu1111 closed 10 months ago

yxu1111 commented 10 months ago

Describe the bug A nil map is always converted to an empty map ({}) which sometimes could cause issues if the caller treats them differently

To Reproduce pass in a member variable that is a map of value nil will return a map of value '{}'

Expected behavior Ideally it should keep the original behavior - nil to nil and {} to {}

Thanks!

jmattheis commented 10 months ago

Thanks for the report, could you try out the map-nil branch and verify the problem is fixed for you?

yxu1111 commented 10 months ago

yes, it works great! Thank you for your in-time response and quick fix!

jmattheis commented 10 months ago

Released with v1.3.1.