Skip to content

Instantly share code, notes, and snippets.

@tenntenn
Created December 29, 2012 08:10
Show Gist options
  • Save tenntenn/4405374 to your computer and use it in GitHub Desktop.
Save tenntenn/4405374 to your computer and use it in GitHub Desktop.
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