jinzhu / copier

Copier for golang, copy value from struct to struct and more
MIT License
5.58k stars 489 forks source link

Copy didn't success, error should be returned #150

Open harrisonho99 opened 2 years ago

harrisonho99 commented 2 years ago

Unsuccessful copy, expected error return

    src := struct{ Name string }{Name: "harrison"}
    dst := make(map[string]interface{})

    err := copier.CopyWithOption(&dst, src, copier.Option{DeepCopy: true})
    if err != nil { // if copy didn't success, error should be returned
        panic(err)
    }

    fmt.Println(dst) // empty map

Description

https://goplay.tools/snippet/ra4iaMjkHnl