1 // Copyright 2013 Dario Castañé. All rights reserved.
2 // Copyright 2009 The Go Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
7 Package mergo merges same-type structs and maps by setting default values in zero-value fields.
9 Mergo won't merge unexported (private) fields but will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection).
13 From my own work-in-progress project:
15 type networkConfig struct {
18 ServerType string `json: "server_type"`
22 type FssnConfig struct {
26 var fssnDefault = FssnConfig {
35 // Inside a function [...]
37 if err := mergo.Merge(&config, fssnDefault); err != nil {