Files
gvc/client/test/test.go

37 lines
549 B
Go

package main
import (
"fmt"
"reflect"
"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, mergo.WithTransformers())
fmt.Println(dest)
// Will print
// {two 2}
}
func MergeStrings(typ reflect.Type) func(dst, src reflect.Value) error {
if typ == reflect.TypeOf([]string{}) {
return func(dst, src reflect.Value) error {
}
}
}