I have two struct types
type type1 struct {
a1,b1,c1 string
}
type type2 struct {
a2,b2 string
}
and want to change type of variable p if the condition is true. How I am supposed to do it in Go ? Below does not work. And I think the question 'Golang : Is conversion between different struct types possible?' does not address this case because I am getting error "cannot convert p .. cannot use type2 as type1 in assignment ...too many values in struct initializer"
var p type1
if <condition> {
p = type2(p)
p = type2{"1","2"}
}