Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

field with same name but different type #17

Closed
WingGao opened this issue Jun 6, 2017 · 1 comment
Closed

field with same name but different type #17

WingGao opened this issue Jun 6, 2017 · 1 comment

Comments

@WingGao
Copy link
Contributor

WingGao commented Jun 6, 2017

type structSameName1 struct {
	A string
	B int64
	C time.Time
}
type structSameName2 struct {
	A string
	B time.Time
	C int64
}

obj1 := structSameName1{A: "123", B: 2, C: time.Now()}
obj2 := &structSameName2{}
err := copier.Copy(obj2, &obj1)
t.Log(err)

It will raise an error
panic: reflect: call of reflect.Value.FieldByName on int64 Value

@jinzhu
Copy link
Owner

jinzhu commented Aug 25, 2017

Should been fixed, thank you for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants