Skip to content

Instantly share code, notes, and snippets.

@comtom
Created September 27, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save comtom/67ff7cb5b9e047fb48d2894749acc242 to your computer and use it in GitHub Desktop.
Save comtom/67ff7cb5b9e047fb48d2894749acc242 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
messages := make(chan string)
signals := make(chan bool)
select {
case msg := <-messages:
fmt.Println("received message", msg)
default:
fmt.Println("no message received")
}
msg := "hi"
select {
case messages <- msg:
fmt.Println("sent message", msg)
default:
fmt.Println("no message sent")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment