A “select” statement chooses which of a set of possible send or receive operations will proceed. • send と receive ができているものを選択する(順序保証は無し) • "A Tour of Go" では Concurrency で2番目に出てくるぐらい重要
which of a set of possible send or receive operations will proceed. • “send” は `<-var`、“receive” は `var<-` のこと • これは io.Reader/io.Writer じゃなくてチャネル操作 • あれ? Read/Write を多重化できないの? → できない!なんで? • できたら便利なのに…
time.NewTicker(time.Minute) defer ticker.Stop() for { select { case <-ticker.C: // send keep-alive probe case n, err := r.Read(buf): // handle read data } }