jinzhu / copier

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

[Bug] Ordering of field in Struct leads to panic #84

Closed phuoc-insignia closed 3 years ago

phuoc-insignia commented 3 years ago

Reproducible Example

https://play.golang.org/p/hZnz2rIy2_Z

Description

Please look at the example code. I can copy this struct:

type Work struct {
    ID      string  `json:"id"`
    Name    string  `json:"name"`
    UserID  *string `json:"user_id"`
    Website *string `json:"website"`
    Timestamps
}

but not this:

type NotWork struct {
    ID      string  `json:"id"`
    UserID  *string `json:"user_id"`
    Name    string  `json:"name"`
    Website *string `json:"website"`
    Timestamps
}
zerosnake0 commented 3 years ago

@phuoc-insignia plz check with the latest (v0.2.5)

phuoc-insignia commented 3 years ago

@phuoc-insignia plz check with the latest (v0.2.5)

Thanks for quick reponse. It works perfertly now!