Is there anything equivalent in Go to the dynamic Class instantiation capabilities provided by languages like Java (note: requisite exception handling logic has been omitted here for the sake of brevity):
Class cls = Class.forName("org.company.domain.User");
Constructor<User> userConstructor = cls.getConstructor();
User user1 = userConstructor.newInstance();
The short Java snippet above essentially grabs reference to the Class via the supplied fully qualified classpath string, the class reference is then used to obtain reference to a zero-argument constructor (where one exists) and finally the constructor is used to obtain reference to an instance of the class.
I've yet to find an example of a similar mechanism in Go that may achieve similar results. More specifically, it would seem that the reflect package in go requires that the caller already have reference to the type of struct they wish to instantiate. The standard idiom in this regard seems to be as follows:
reflect.New(reflect.TypeOf(domain.User))
Note: The argument provided to the reflect.TypeOf function MUST be a Type not a string. Can a struct be instantiated in Go, via the reflect package, using nothing more than its fully qualified name?