github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2012/concurrency/support/helpers.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  func main() {
     6  	var value int
     7  
     8  	// START1 OMIT
     9  	// Declaring and initializing.
    10  	var c chan int
    11  	c = make(chan int)
    12  	// or
    13  	c := make(chan int) // HL
    14  	// STOP1 OMIT
    15  
    16  	// START2 OMIT
    17  	// Sending on a channel.
    18  	c <- 1 // HL
    19  	// STOP2 OMIT
    20  
    21  	// START3 OMIT
    22  	// Receiving from a channel.
    23  	// The "arrow" indicates the direction of data flow.
    24  	value = <-c // HL
    25  	// STOP3 OMIT
    26  
    27  	_ = value
    28  }