Mergo is a Go library that merges structs and maps by setting default values in zero-value fields.
The tool solves the problem of combining configuration objects and avoiding repetitive conditional logic when applying defaults. It works by recursively merging exported fields of same-type structs and maps, leaving unexported fields untouched. The library does not merge structs nested inside maps since they are not addressable through Go reflection.
Mergo suits projects that need to layer configuration defaults or combine structured data without manual field-by-field assignment. It is particularly useful for applications handling configuration management where default values must be applied cleanly. The tool is stable and frozen, with no new features accepted; the maintainers have indicated that a future major version may improve the implementation and address corner cases.
The project maintains a frozen feature set and is considered production-ready. The codebase has been stable over time with only critical fixes applied, as evidenced by the reversion of a problematic change in a recent release. The tool is widely adopted across large-scale projects in the Go ecosystem.