golang chan make前后值比较

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:
make no value: 0x1840d080
value one: 0x1840d080
out value: 0x1840d080

你可能感兴趣的:(Go语言)