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

0.3.4 nested struct, struct starts with lowercase, cannot copy #122

Open
binbin0325 opened this issue Dec 5, 2021 · 0 comments
Open

0.3.4 nested struct, struct starts with lowercase, cannot copy #122

binbin0325 opened this issue Dec 5, 2021 · 0 comments
Assignees

Comments

@binbin0325
Copy link

binbin0325 commented Dec 5, 2021

Reproducible Example

code
`package main

import (
"fmt"
"github.com/jinzhu/copier"
)

type baseUser struct {
Id int
Name string
}

type User struct {
baseUser
Name string
}

type Employee struct {
baseUser
// Tell copier.Copy to panic if this field is not copied.
Name string copier:"must"
}

func main() {
b := baseUser{Id: 11}
var (
user = User{baseUser: b, Name: "Jinzhu"}
employee = Employee{Name: "zzz"}
)

copier.Copy(&employee, &user)

fmt.Printf("%#v \n", employee)

}
`

Description

0.3.4 nested struct, struct starts with lowercase, cannot copy

version:0.3.4
output: main.Employee{baseUser:main.baseUser{Id:0, Name:""}, Name:"Jinzhu"}

version:0.3.2
output: main.Employee{baseUser:main.baseUser{Id:11, Name:""}, Name:"Jinzhu"}

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