Исходники и презентации
This commit is contained in:
14
lessons/channels/copy_channel/main.go
Normal file
14
lessons/channels/copy_channel/main.go
Normal file
@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
source := make(chan int)
|
||||
clone := source
|
||||
|
||||
go func() {
|
||||
source <- 1
|
||||
}()
|
||||
|
||||
fmt.Println(<-clone)
|
||||
}
|
||||
Reference in New Issue
Block a user