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

feat: Copy to Nil pointer of struct #210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zedisdog
Copy link

@zedisdog zedisdog commented Apr 23, 2024

type struct1 struct {
    A int
}

type struct2 struct {
    A int
}

s1 := struct1{A: 1}
var s2 *struct2

err := copier.Copy(&s2, s1)
if err != nil {
    t.Error("should not error")
}
if s1.A != (*s2).A {
    t.Error("should equal")
}

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

Successfully merging this pull request may close these issues.

1 participant