edits
This commit is contained in:
parent
b044506449
commit
e6a3c56d77
@ -1,7 +1,7 @@
|
||||
// When using channels as function parameters, you can
|
||||
// specify if a channel is meant to only send or receive
|
||||
// values. This specificity further increases the
|
||||
// type-safety of the program.
|
||||
// values. This specificity increases the type-safety of
|
||||
// the program.
|
||||
|
||||
package main
|
||||
|
||||
@ -15,7 +15,7 @@ func ping(pings chan<- string, msg string) {
|
||||
}
|
||||
|
||||
// The `pong` function accepts one channel for receives
|
||||
// (`pings`) and a second for sends (`pongs`)
|
||||
// (`pings`) and a second for sends (`pongs`).
|
||||
func pong(pings <-chan string, pongs chan<- string) {
|
||||
msg := <-pings
|
||||
pongs <- msg
|
||||
|
@ -13,7 +13,7 @@ import "time"
|
||||
func worker(done chan bool) {
|
||||
fmt.Print("working...")
|
||||
time.Sleep(time.Second)
|
||||
fmt.Println(" done")
|
||||
fmt.Println("done")
|
||||
|
||||
// Send a value to notify that we're done.
|
||||
done <- true
|
||||
|
Loading…
x
Reference in New Issue
Block a user