I am learning Go right now and would like to initialize a type using variadic arguments without using reflection. Is it possible?
Here an example:
type MyType struct {
field1 string
field2 string
...
fieldN string
}
func CreateMyType(arguments ...string) *MyType {
inst := MyType{arguments...} // does not work, is there any other way???
return &inst
}
Note It makes me really sad, that the question is downvoted, where I ask legitimate things and try to learn out of them :(