mergo
mergo copied to clipboard
Readme showcasing mergo.Merge() is actually showing mergo.MergeWithOverwrite() functionality
The demo code in the readme showcasing mergo.Merge()
package main
import (
"fmt"
"github.com/imdario/mergo"
)
type Foo struct {
A string
B int64
}
func main() {
src := Foo{
A: "one",
B: 2,
}
dest := Foo{
A: "two",
}
mergo.Merge(&dest, src)
fmt.Println(dest)
// Will print
// {two 2}
}
is actually using mergo.MergeWithOverwrite()
Thanks for opening a new issue. The team has been notified and will review it as soon as possible. For urgent issues and priority support, visit https://xscode.com/imdario/mergo
Sorry, it's not the case. dest
after merge contains its A
field untouched - with value two
- and B
with value 2
from src.B
. Overwrite would leave A
with the same as src.A
.