![]() It won't merge empty structs value as they are zero values too. Mergo won't merge unexported (private) fields but will do recursively any exported one. You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u /imdario/mergo. ![]() We added an optional/variadic argument so that it won't break the existing code. Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. Also, this version adds suppot for go modules. We consider 0.3.10 as stable but not bug-free. Please keep in mind that a problematic PR broke 0.3.9. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. It also won't merge structs inside maps (because they are not addressable using Go reflection). Mergo won't merge unexported (private) fields. Mergo merges same-type structs and maps by setting default values in zero-value fields. Useful for configuration default values, avoiding messy if-statements. ![]() A helper to merge structs and maps in Golang.
0 Comments
Leave a Reply. |