package main
import (
"fmt"
)
func main() {
var chtest chan string
fmt.Println("no make:", chtest)
chtest = make(chan string, 10)
fmt.Println("make no value:", chtest)
chtest <- "one"
fmt.Println("value one:", chtest)
<-chtest
fmt.Println("out value:", chtest)
}
输出:
no make: <nil>
make no value: 0x1840d080
value one: 0x1840d080
out value: 0x1840d080