I need to create StructField, in which I need to pass reflect.Type value for the Type field. I would like to pass other types like reflect.Bool, reflect.Int to function which will be used in the construction of StructField. I cannot do this with the code below
reflect.StructField{
Name: strings.Title(v.Name),
Type: reflect.Type(reflect.String),
Tag: reflect.StructTag(fmt.Sprintf(`xml:"%v,attr"`, v.Name)),
}
Because it
Cannot convert an expression of the type 'Kind' to the type 'Type'
Aucun commentaire:
Enregistrer un commentaire