package main import ( "fmt" "github.com/imdario/mergo" ) type Foo struct { Ignore []string B int64 } func main() { src := Foo{ Ignore: []string{"one", "two", "three"}, B: 2, } dest := Foo{ Ignore: []string{"one", "two", "four", "seven"}, } mergo.Merge(&dest, src) fmt.Println(dest) // Will print // {two 2} }