Open mahadeva1989 opened 1 year ago
I have a situation where I'm not able to copy unexported struct type values to the exported base fields.
package main
import ( "fmt"
"github.com/jinzhu/copier"
)
func main() { type common struct { Common1 int json:"Common1" Common2 string json:"Common2" }
json:"Common1"
json:"Common2"
type source struct { Name string `json:"Name"` Description string `json:"Description"` common } type destination struct { Name string `json:"Name"` Description string `json:"Description"` Common1 int `json:"Common1"` Common2 string `json:"Common2"` } src := source{Name: "name", Description: "description", common: common{Common1: 2, Common2: "common2"}} dest := destination{} copier.Copy(&dest, src) fmt.Printf("values %v", dest)
}
Actual : values {name description 0 }
Expected Please advise me on how to get the output as values {name description 2 common2}
I have a situation where I'm not able to copy unexported struct type values to the exported base fields.
package main
import ( "fmt"
)
func main() { type common struct { Common1 int
json:"Common1"
Common2 stringjson:"Common2"
}}
Actual : values {name description 0 }
Expected Please advise me on how to get the output as values {name description 2 common2}