dimanche 20 décembre 2015

Initialize all channels in a struct using reflect

I have some structs that contain some fields and some channels. I managed to dynamically fill the fields from a map, but how do I initialize the channels? I need to set the size of them as well.

type MyStruct struct {
    ...
    Out           chan *mypackage.OtherStruct `json:"-"`
    Quit          chan struct{}               `json:"-"`
}





Aucun commentaire:

Enregistrer un commentaire