Created
December 29, 2012 08:10
-
-
Save tenntenn/4405374 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// read and write | |
ch1 := make(chan int) | |
fmt.Printf("ch1=%t\n", ch1) | |
// read only | |
ch2 := (<-chan int)(ch1) | |
fmt.Printf("ch2=%t\n", ch2) | |
// send only | |
ch3 := (chan<- int)(ch1) | |
fmt.Printf("ch3=%t\n", ch3) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment