GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
sample-golang
/
01_hello
Browse code
add pipeline sample
master
1 parent
cec73fc
commit
cfd59e7ae9d9e8264a4a52358c7d703756a4ac79
yhornisse
authored
on 9 Oct 2021
Patch
Showing
1 changed file
goroutine/pipeline.go
Ignore Space
Show notes
View
goroutine/pipeline.go
0 → 100644
package main import ( "fmt" ) func main() { done := make(chan int) p := make(chan int) go func() { for i := 0; i < 5; i++ { p <- i } }() go func() { for { x := <- p done <- x * x } }() for i := 0; i < 5; i++ { fmt.Println(<-done) // 0, 1, 4, 9, 16 } }
Show line notes below