I have a function.
func doSome(v interface{}) {
}
If im pass pointer of array struct in function, she must fill array.
type Color struct {
}
type Brush struct {
}
var c []Color
doSome(&c) // after с is array contains 3 elements type Color
var b []Brush
doSome(&b) // after b is array contains 3 elements type Brush
Maybe need use reflection, but how?
Aucun commentaire:
Enregistrer un commentaire