I don’t fully understand your use case yet, but it might be worth looking at doing this without reflection. Generally, using Go’s native type handling is easier for others to read than using reflection. You could consider something like
func GetStructByName(name string) interface{} {
switch t {
case "s1":
return S1{}
case "s2":
return S2{}
//and so on
}
}
live example: https://play.golang.org/p/V2SlO0H0Hh