Golang select default语句
2019-06-11 本文已影响0人
FredricZhu
package main
import (
"fmt"
"time"
)
func main() {
start := time.Now()
var c1, c2 <-chan int
select {
case <-c1:
case <-c2:
default:
fmt.Printf("In default after %v\n\n", time.Since(start))
}
}
image.png