In Go, how do you create the instance of an object from its type at run time? I suppose you would also need to get the actual type of the object first too?
You can use reflect.Zero() which will return the representation of the zero value of the struct type. (similar to if you did var foo StructType) This is different from reflect.New() as the latter will dynamically allocate the struct and give you a pointer, similar to new(StructType)