go-copy
go-copy copied to clipboard
Cannot copy a struct that embedding an interface
Hi, I have a problem.
If you use go-copy to copy a "struct embedding interface" like in the sample, an error will occur.
package main
import (
"github.com/liguangsheng/go-copy"
"log"
)
type Interface interface {}
type SampleA struct {
Interface
FieldStr string
FieldInt int
}
type SampleB struct {
FieldStr string
FieldInt int
}
func main() {
src := SampleA{
FieldStr: "test",
FieldInt: 100,
}
var dest SampleB
copier := copy.NewCopier()
if err := copier.Copy(&dest, &src); err != nil {
log.Fatal(err)
}
log.Print(dest)
}