Skip to content

Instantly share code, notes, and snippets.

@kaipyroami
Created September 4, 2019 18:36
Show Gist options
  • Save kaipyroami/98cb0565c9ad32eff404a772044260cd to your computer and use it in GitHub Desktop.
Save kaipyroami/98cb0565c9ad32eff404a772044260cd to your computer and use it in GitHub Desktop.
Channel example using a buffer.
package main
import (
"fmt"
)
func main() {
c := make(chan int, 1) // Buffer
c <- 42
fmt.Println(<-c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment