I'm trying to write a mocking library in Go and I create mock structs with reflection like this:
mockStruct := reflect.StructOf([]reflect.StructField{
{
Name: "Field1",
Type: reflect.TypeOf(0),
},
{
Name: "Field2",
Type: reflect.TypeOf(0),
},
})
mock := reflect.New(mock).Elem()
Is there any way to create methods programmatically on these structs?
Thanks in advance for the answers!
Aucun commentaire:
Enregistrer un commentaire