I have two structures
type A struct {
a int
b string
}
type B struct {
A
c string
}
I would like to convert a variable of type A to type B (A defined only the base fields, which are crucial for some parts, B, on the other hand, contains "full" data).
Is it possible in Go or do I need to manually copy the fields (or create an A.GetB () method or something like this and use this to convert A to B)?
source
share